官术网_书友最值得收藏!

Disabling specific auto-configuration classes

At any point in time, if you don't want to use some of the specific auto-configuration classes or if they don't suit your needs, you can disable those auto-configuration classes. For this, you can use the exclude attribute of the @EnableAutoConfiguration annotation. Let's see the following example:

@EnableAutoConfiguration(exclude=DataSourceAutoConfiguration.class) 
public class ApplicationConfiguration { 
   ... 
} 

As per the code snippet, we have used the @EnableAutoConfiguration annotation with the exclude attribute. The DataSourceAutoConfiguration class will be excluded from the auto-configuration. Similarly, we can define a list of auto-configuration classes that need to be excluded.

You can define exclusions both at the annotation level and by using the property.

Let's move to another point of customizing auto-configuration in the Spring Boot application.

主站蜘蛛池模板: 秦安县| 祁阳县| 霍林郭勒市| 塔河县| 康乐县| 溆浦县| 尖扎县| 岱山县| 九龙县| 深州市| 宣恩县| 嘉黎县| 玉田县| 清水河县| 彭州市| 那曲县| 康定县| 保靖县| 广西| 金秀| 永寿县| 中西区| 炎陵县| 当阳市| 兴国县| 虎林市| 子洲县| 定陶县| 沁水县| 纳雍县| 静安区| 澳门| 微山县| 孟州市| 集安市| 民和| 读书| 宁乡县| 龙陵县| 新昌县| 离岛区|