Eureka錯誤解決方法

# Eureka錯誤解決方法

## security.basic.enabled 配置過時或不可用

默認(rèn)情況下:

用戶名:user

密碼:啟動應(yīng)用在控制臺會輸出,如下圖:

![security密碼](//img.mukewang.com/5db0756d00012a9114400334.png)

也可以通過如下屬性配置:

spring.security.user.name

spring.security.user.password

如果想要關(guān)閉驗(yàn)證功能:

簡單粗暴方法:

把 Security包從pom.xml中移出去

科學(xué)一點(diǎn)的:

在Application啟動類上(或者任意@Configure配置類上)增加如下注解:

~~~ java

@EnableAutoConfiguration(exclude = {? ? org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class})

~~~

## defaultZone 配置

![圖片描述](//img.mukewang.com/5db07690000189b413250307.png)

> eureka 中心與服務(wù)需要配置一樣的地址

## 禁用Eureka作為客戶端注冊

~~~ java

eureka.client.register-with-eureka=false

eureka.client.fetch-registry=false

~~~

## 超時問題

com.netflix.hystrix.exception.HystrixRuntimeException: api timed-out and no fallback available. 超時問題

或者 Read timed-out 錯誤

在 yml中加入

~~~ java

hystrix:

command:

? default:

? execution:

? ? isolation:

? ? thread:

? ? ? timeoutInMilliseconds: 16000

~~~

或者

~~~ java

hystrix:

metrics:

? enabled: true

command:

? default:

? execution:

? ? isolation:

? ? thread:

? ? ? timeoutInMilliseconds: 16000

~~~

## 包引用

~~~ java

<!--這個依賴千萬不能省略-->

<dependency>

<groupId>org.springframework.cloud</groupId>

<artifactId>spring-cloud-starter-eureka</artifactId>

</dependency>

~~~

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容