自定义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})
相关文章
相关标签/搜索