package org.mybatis.spring.mapper.annotation;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import org.mybatis.spring.mapper.MapperBeanRegistrar;
import org.mybatis.spring.mapper.MapperScannerConfigurer;
import org.springframework.context.annotation.Import;

/**
 * Use this annotation to register MyBatis mapper interfaces when using Java
 * Config. It performs when same work as {@link MapperScannerConfigurer} via
 * {@link MapperBeanRegistrar}.
 * 
 * @author lanyonm
 * @since 1.1.2
 * @see MapperBeanRegistrar
 * @see MapperScannerConfigurer
 */
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Documented
@Import(MapperBeanRegistrar.class)
public @interface EnableMyBatisMapperScanner {

	/**
	 * Alias for the {@link #basePackages()} attribute.
	 * Allows for more concise annotation declarations e.g.:
	 * {@code @EnableMyBatisMapperScanner("org.my.pkg")} instead of
	 * {@code @EnableMyBatisMapperScanner(basePackages={"org.my.pkg"})}.
	 */
	String[] value() default {};

	/**
	 * Base packages to scan for MyBatis interfaces. Note that only interfaces
	 * with at least one method will be registered; concrete classes will be
	 * ignored.
	 */
	String[] basePackages() default {};
}

@@ -603,16 +603,871 @@
 r%7D.%0A * %0A
+ * %3Cp%3EConfiguration example:%3C/p%3E%0A * %3Cpre class=%22code%22%3E%0A * &#064;Configuration%0A * &#064;EnableMyBatisMapperScanner(%22org.my.pkg.persistence%22)%0A * public class AppConfig %7B%0A * %0A *   &#064;Bean%0A *   public DataSource dataSource() %7B%0A *     return new EmbeddedDatabaseBuilder()%0A *              .setType(EmbeddedDatabaseType.H2)%0A *              .build();%0A *   %7D%0A * %0A *   &#064;Bean%0A *   public DataSourceTransactionManager transactionManager() %7B%0A *     return new DataSourceTransactionManager(dataSource());%0A *   %7D%0A * %0A *   &#064;Bean%0A *   public SqlSessionFactory sqlSessionFactory() throws Exception %7B%0A *     SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();%0A *     sessionFactory.setDataSource(dataSource());%0A *     sessionFactory.setTypeAliasesPackage(%22org.my.pkg.domain%22);%0A *     return sessionFactory.getObject();%0A *   %7D%0A * %7D%0A * %3C/pre%3E%0A * %0A
  * @auth

add usage example to Enable annotation