最近遇到个场景,需要在使用@Bean注解定义bean的时候为对象设置一些属性,比如扫描路径,因为路径经常发布新特性的时候需要修改,所以就计划着放在配置文件中,然后通过@ConfigurationProperties或@Value结合@PropertySource注入,类似如下: @Configuration @PropertySource("classpath:application.properties") public class AbcConfig { @Value("
通过@Configuration使用MyBatis配置类的资料比较少,大部分都是通过XML的形式.找了好久,最终还是通过官方的文档找到了解决方法:http://www.mybatis.org/spring-boot-starter/mybatis-spring-boot-autoconfigure/ Using a ConfigurationCustomizer The MyBatis-Spring-Boot-Starter provide opportunity to customize a