Spring SpringBoot启动时 @ComponentScan 排除指定Bean初始化

在启动类上加入 @ComponentScan 注解,并设置excludeFilters即可排除指定Bean初始化:

@ComponentScan(excludeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = {OrderService.class, ProductService.class}))

猜你喜欢

转载自blog.csdn.net/Anenan/article/details/129135954