自定義springboot-starter注意事項

注意引用方的ComponentScan

springboot默認scan的包名是其main類所在的包名。若是引入的starter包名不同,須要本身添加scan。spring

@ComponentScan(basePackages = {"com.xixicat.demo","com.xixicat.sms"})

對於starter中有feign的,須要額外指定springboot

@EnableFeignClients(basePackages = {"com.xixicat.sms"})

對於exclude一些autoConfig

@EnableAutoConfiguration(exclude = {MetricFilterAutoConfiguration.class})
相關文章
相關標籤/搜索