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

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.

主站蜘蛛池模板: 枝江市| 浦东新区| 孝昌县| 县级市| 曲松县| 永兴县| 呼和浩特市| 通化市| 渭源县| 金堂县| 静海县| 波密县| 沈丘县| 兰州市| 章丘市| 阿坝县| 浙江省| 富源县| 宁武县| 石景山区| 德江县| 旅游| 十堰市| 清原| 修水县| 鄂托克旗| 开封县| 江安县| 舟曲县| 普陀区| 汝阳县| 庆云县| 海阳市| 常宁市| 奉节县| 靖西县| 贺州市| 三门县| 牡丹江市| 安义县| 西畴县|