diff --git a/src/main/java/org/mybatis/spring/annotation/Mapper.java b/src/main/java/org/mybatis/spring/annotation/Mapper.java
new file mode 100644
index 0000000000..729c6b011f
--- /dev/null
+++ b/src/main/java/org/mybatis/spring/annotation/Mapper.java
@@ -0,0 +1,37 @@
+/**
+ * Copyright 2010-2017 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.mybatis.spring.annotation;
+
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import java.lang.annotation.Documented;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * Marker interface for indicate the MyBatis mapper.
+ *
+ * @author Kazuki Shimizu
+ * @since 1.3.2
+ */
+@Documented
+@Inherited
+@Retention(RUNTIME)
+@Target(TYPE)
+public @interface Mapper {
+}
diff --git a/src/test/java/org/mybatis/spring/annotation/MapperScanTest.java b/src/test/java/org/mybatis/spring/annotation/MapperScanTest.java
index c42ced365a..61cc17d785 100644
--- a/src/test/java/org/mybatis/spring/annotation/MapperScanTest.java
+++ b/src/test/java/org/mybatis/spring/annotation/MapperScanTest.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2010-2016 the original author or authors.
+ * Copyright 2010-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -37,7 +37,6 @@
import org.springframework.beans.factory.support.GenericBeanDefinition;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Configuration;
-import org.springframework.stereotype.Component;
import com.mockrunner.mock.jdbc.MockDataSource;
@@ -257,12 +256,12 @@ public static class AppConfigWithMarkerInterface {
}
@Configuration
- @MapperScan(basePackages = "org.mybatis.spring.mapper", annotationClass = Component.class)
+ @MapperScan(basePackages = "org.mybatis.spring.mapper", annotationClass = Mapper.class)
public static class AppConfigWithAnnotation {
}
@Configuration
- @MapperScan(basePackages = "org.mybatis.spring.mapper", annotationClass = Component.class, markerInterface = MapperInterface.class)
+ @MapperScan(basePackages = "org.mybatis.spring.mapper", annotationClass = Mapper.class, markerInterface = MapperInterface.class)
public static class AppConfigWithMarkerInterfaceAndAnnotation {
}
diff --git a/src/test/java/org/mybatis/spring/config/annotation.xml b/src/test/java/org/mybatis/spring/config/annotation.xml
index d588900845..17e8317cf1 100644
--- a/src/test/java/org/mybatis/spring/config/annotation.xml
+++ b/src/test/java/org/mybatis/spring/config/annotation.xml
@@ -1,7 +1,7 @@
-
+
diff --git a/src/test/java/org/mybatis/spring/config/marker-and-annotation.xml b/src/test/java/org/mybatis/spring/config/marker-and-annotation.xml
index 2e39dd9748..1ef0d30fd9 100644
--- a/src/test/java/org/mybatis/spring/config/marker-and-annotation.xml
+++ b/src/test/java/org/mybatis/spring/config/marker-and-annotation.xml
@@ -1,7 +1,7 @@
+ annotation="org.mybatis.spring.annotation.Mapper" />
diff --git a/src/test/java/org/mybatis/spring/mapper/AnnotatedMapper.java b/src/test/java/org/mybatis/spring/mapper/AnnotatedMapper.java
index 703f32d388..1b28a47445 100644
--- a/src/test/java/org/mybatis/spring/mapper/AnnotatedMapper.java
+++ b/src/test/java/org/mybatis/spring/mapper/AnnotatedMapper.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2010-2016 the original author or authors.
+ * Copyright 2010-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,11 +15,11 @@
*/
package org.mybatis.spring.mapper;
-import org.springframework.stereotype.Component;
+import org.mybatis.spring.annotation.Mapper;
// annotated interface for MapperScannerPostProcessor tests
// ensures annotated classes are loaded
-@Component
+@Mapper
public interface AnnotatedMapper {
public void method();
}
diff --git a/src/test/java/org/mybatis/spring/mapper/AnnotatedMapperZeroMethods.java b/src/test/java/org/mybatis/spring/mapper/AnnotatedMapperZeroMethods.java
index 99c67dfa0d..3b7dcaeee6 100644
--- a/src/test/java/org/mybatis/spring/mapper/AnnotatedMapperZeroMethods.java
+++ b/src/test/java/org/mybatis/spring/mapper/AnnotatedMapperZeroMethods.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2010-2016 the original author or authors.
+ * Copyright 2010-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,10 +15,10 @@
*/
package org.mybatis.spring.mapper;
-import org.springframework.stereotype.Component;
+import org.mybatis.spring.annotation.Mapper;
// annotated interface for MapperScannerPostProcessor tests
// ensures annotated class with no methods is not loaded
-@Component
+@Mapper
public interface AnnotatedMapperZeroMethods {
}
diff --git a/src/test/java/org/mybatis/spring/mapper/MapperScannerConfigurerTest.java b/src/test/java/org/mybatis/spring/mapper/MapperScannerConfigurerTest.java
index ac454e9c8e..2ee4cb33b3 100644
--- a/src/test/java/org/mybatis/spring/mapper/MapperScannerConfigurerTest.java
+++ b/src/test/java/org/mybatis/spring/mapper/MapperScannerConfigurerTest.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2010-2016 the original author or authors.
+ * Copyright 2010-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,6 +27,7 @@
import org.junit.Test;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.SqlSessionTemplate;
+import org.mybatis.spring.annotation.Mapper;
import org.mybatis.spring.mapper.child.MapperChildInterface;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.beans.factory.config.BeanDefinition;
@@ -36,7 +37,6 @@
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.GenericBeanDefinition;
import org.springframework.context.support.GenericApplicationContext;
-import org.springframework.stereotype.Component;
import com.mockrunner.mock.jdbc.MockDataSource;
@@ -128,7 +128,7 @@ public void testMarkerInterfaceScan() {
@Test
public void testAnnotationScan() {
applicationContext.getBeanDefinition("mapperScanner").getPropertyValues().add(
- "annotationClass", Component.class);
+ "annotationClass", Mapper.class);
startContext();
@@ -145,7 +145,7 @@ public void testMarkerInterfaceAndAnnotationScan() {
applicationContext.getBeanDefinition("mapperScanner").getPropertyValues().add(
"markerInterface", MapperInterface.class);
applicationContext.getBeanDefinition("mapperScanner").getPropertyValues().add(
- "annotationClass", Component.class);
+ "annotationClass", Mapper.class);
startContext();
diff --git a/src/test/java/org/mybatis/spring/mapper/child/MapperChildInterface.java b/src/test/java/org/mybatis/spring/mapper/child/MapperChildInterface.java
index ba1bbe93a7..5922b5d8f0 100644
--- a/src/test/java/org/mybatis/spring/mapper/child/MapperChildInterface.java
+++ b/src/test/java/org/mybatis/spring/mapper/child/MapperChildInterface.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2010-2016 the original author or authors.
+ * Copyright 2010-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,12 +15,12 @@
*/
package org.mybatis.spring.mapper.child;
+import org.mybatis.spring.annotation.Mapper;
import org.mybatis.spring.mapper.MapperInterface;
-import org.springframework.stereotype.Component;
// interface for MapperScannerPostProcessor tests
// tests subpackage search
-@Component
+@Mapper
public interface MapperChildInterface extends MapperInterface {
public void childMethod();
}