Springboot

1:启动类,conponentScans

@SpringBootApplication
@Configuration
@Slf4j
@Validated
@ComponentScans(value = {@ComponentScan("com.xxx.boot")}) //scan
@MapperScan(basePackages = {"com.xxx.boot"}) //mybatis
@SpringBootApplication
@Configuration
@Slf4j
@Validated
@MapperScan(basePackages = {"com.xxx.boot"}) 
@ComponentScan({"com.xxx.boot"})

compomentscan和mapperscan里的扫描路径不要一样,不然会出现在非mapper下查找mapper的故障

你可能感兴趣的:(spring,boot)