xxw1754352621 / java-dev

愿景:提升自我知识容量,扩展自我知识边界
Apache License 2.0
6 stars 2 forks source link

对AutoConfiguration自动注入类的排除 #12

Closed xxw1754352621 closed 5 years ago

xxw1754352621 commented 5 years ago

排除组件自动注入,使用自己实现的注入

https://docs.spring.io/spring-boot/docs/2.1.5.RELEASE/reference/htmlsingle/#using-boot-disabling-specific-auto-configuration 说明:You can define exclusions both at the annotation level and by using the property

方法一: spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration

方法二: 使用注解 @EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})