亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何在不刪除依賴項的情況下從 spring-boot-2 中的 yaml/properties

如何在不刪除依賴項的情況下從 spring-boot-2 中的 yaml/properties

動漫人物 2023-06-14 15:56:32
我創建了一個 spring-boot-2 gradle 項目,也在build.gradle文件中添加了下面給出的 Kafka 相關依賴項。dependencies {    implementation 'org.springframework.cloud:spring-cloud-starter-zipkin'    compile 'org.springframework.cloud:spring-cloud-starter-bus-kafka'}現在我想從文件中禁用所有與 Kafka 相關的自動配置,application.yaml 因為我已嘗試在我的 yaml 文件中給出以下代碼。spring:  autoconfigure:      exclude:        - org.springframework.boot.autoconfigure.kafka.KafkaAutoConfiguration實施上述措施后,Kafka 仍會自動配置并開始將 Kafka 與應用程序集成。我也試過下面的代碼,但這也不適合我。@SpringBootApplication@EnableAutoConfiguration(exclude = KafkaAutoConfiguration.class)public class ApiGatewayApplication {    public static void main(String[] args) {        SpringApplication.run(ApiGatewayApplication.class, args);    }}現在請任何人幫助我,如何從 yaml/properties 文件中禁用所有與 kafka 相關的自動配置?
查看完整描述

1 回答

?
繁星點點滴滴

TA貢獻1803條經驗 獲得超3個贊

代替@EnableAutoConfiguration(exclude = KafkaAutoConfiguration.class)

你應該做@SpringBootApplication(exclude = KafkaAutoConfiguration.class)


查看完整回答
反對 回復 2023-06-14
  • 1 回答
  • 0 關注
  • 120 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號