av一区二区在线观看_亚洲男人的天堂网站_日韩亚洲视频_在线成人免费_欧美日韩精品免费观看视频_久草视

您的位置:首頁(yè)技術(shù)文章
文章詳情頁(yè)

解析spring cloud ouath2中的Eureka

瀏覽:115日期:2023-07-23 11:31:29

老生常談的配置 但是還是需要說(shuō)明一下

EurekaApplication

@EnableEurekaServer指定為server端

@EnableEurekaServer@SpringBootApplicationpublic class EurekaApplication { public static void main(String[] args) { SpringApplication.run(EurekaApplication.class, args); } }

WebSecurityConfig

看到這眼熟不呢 沒(méi)錯(cuò) Eureka也開(kāi)啟spring security 在訪問(wèn)前臺(tái)頁(yè)面時(shí)也需要輸入賬號(hào)密碼

@Configuration@EnableWebSecuritypublic class WebSecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { super.configure(http); http.csrf().disable().httpBasic(); }}

application.yml

security:user以下配置的賬號(hào)密碼 在訪問(wèn)頁(yè)面需要輸入的

server: port: 7001spring: application: name: eureka security: user: name: admin password: xxxxxxxxxxeureka: client: fetch-registry: false register-with-eureka: false service-url: defaultZone: http://admin:Xk38CNHigBP5jK75@localhost:5001/eureka instance: hostname: localhost prefer-ip-address: truelogging: config: classpath:logback.xml level: root: info

pom.xml

<dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> <exclusions> <exclusion> <groupId>org.junit.vintage</groupId> <artifactId>junit-vintage-engine</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-test</artifactId> <scope>test</scope> </dependency> </dependencies>

當(dāng)訪問(wèn)localhost:7001 出現(xiàn)下圖 需要填寫(xiě)賬號(hào)密碼

解析spring cloud ouath2中的Eureka

在其他服務(wù)注冊(cè)時(shí) 也需要指定賬號(hào)密碼

eureka: instance: hostname: ${spring.cloud.client.ip-address} prefer-ip-address: true instance-id: ${eureka.instance.hostname}:${server.port} //與server一致 client: security: basic: user: admin password: xxxxxxxxxxx service-url: defaultZone: http://${eureka.client.security.basic.user}:${eureka.client.security.basic.password}@localhost:7001/eureka

到此這篇關(guān)于spring cloud ouath2中的Eureka的文章就介紹到這了,更多相關(guān)spring cloud ouath2內(nèi)容請(qǐng)搜索好吧啦網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持好吧啦網(wǎng)!

標(biāo)簽: Spring
相關(guān)文章:
主站蜘蛛池模板: 中文字幕婷婷 | 久久久国产精品人人片 | 欧美视频在线观看免费 | 精品日韩在线观看 | 免费一级毛片免费播放 | 国产欧美精品 | 日韩va| 国产一区一区 | 中文字幕在线观看日本 | 日韩不卡一区 | 亚洲精品视频在线 | 性久久 | 国产va在线观看 | 日本少妇中文字幕 | 少妇高潮露脸国语对白 | 国产1级片 | 玖玖视频 | 久久视频这里只有精品 | 日韩成人在线免费观看 | 久久er99热精品一区二区 | av九九| 啪啪毛片| 天天干一干| 经典三级第一页 | 亚洲一区二区在线播放 | 日韩精品免费视频 | 久久久免费看 | 欧美在线视频播放 | www.免费视频. | 在线免费av网站 | 91在线播放视频 | 91看片在线观看 | 亚洲激情欧美激情 | 91亚洲国产成人久久精品网站 | 亚欧av在线 | 久久国产精品视频 | 91福利网站 | 老司机免费福利视频 | 视频一区在线播放 | av久久久 | 一级片在线播放 |