io.github.nichetoolkit.mybatis.configure.MybatisStarterAutoConfigure Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mybatis-toolkit-starter Show documentation
Show all versions of mybatis-toolkit-starter Show documentation
mybatis toolkit starter project for Spring Boot
package io.github.nichetoolkit.mybatis.configure;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
import org.springframework.core.type.AnnotationMetadata;
import org.springframework.lang.NonNull;
/**
* MybatisStarterAutoConfigure
* The mybatis starter auto configure class.
* @author Cyan ([email protected])
* @see lombok.extern.slf4j.Slf4j
* @see org.springframework.boot.autoconfigure.AutoConfiguration
* @see org.springframework.context.annotation.ComponentScan
* @see org.springframework.context.annotation.Import
* @see org.springframework.boot.autoconfigure.ImportAutoConfiguration
* @since Jdk1.8
*/
@Slf4j
@AutoConfiguration
@ComponentScan(basePackages = {"io.github.nichetoolkit.mybatis"})
@Import({MybatisStarterAutoConfigure.MybatisMapperAutoRegister.class})
@ImportAutoConfiguration({MybatisRecordAutoConfigure.class})
public class MybatisStarterAutoConfigure {
/**
* MybatisStarterAutoConfigure
* Instantiates a new mybatis starter auto configure.
*/
public MybatisStarterAutoConfigure() {
log.debug("The auto configuration for [mybatis-starter] initiated");
}
/**
* MybatisMapperAutoRegister
* The mybatis mapper auto register class.
* @author Cyan ([email protected])
* @see org.springframework.context.annotation.ImportBeanDefinitionRegistrar
* @since Jdk1.8
*/
public static class MybatisMapperAutoRegister implements ImportBeanDefinitionRegistrar {
@Override
public void registerBeanDefinitions(@NonNull AnnotationMetadata importingClassMetadata, @NonNull BeanDefinitionRegistry registry) {
MybatisRestMapperScanner scanner = new MybatisRestMapperScanner(registry, false);
scanner.registerFilters();
scanner.doScan("io.github.nichetoolkit.mybatis");
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy