亚洲精品久久久中文字幕-亚洲精品久久片久久-亚洲精品久久青草-亚洲精品久久婷婷爱久久婷婷-亚洲精品久久午夜香蕉

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

解析spring cloud ouath2中的Eureka

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

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

EurekaApplication

@EnableEurekaServer指定為server端

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

WebSecurityConfig

看到這眼熟不呢 沒錯(cuò) Eureka也開啟spring security 在訪問前臺頁面時(shí)也需要輸入賬號密碼

@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以下配置的賬號密碼 在訪問頁面需要輸入的

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)訪問localhost:7001 出現(xiàn)下圖 需要填寫賬號密碼

解析spring cloud ouath2中的Eureka

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

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)容請搜索好吧啦網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持好吧啦網(wǎng)!

標(biāo)簽: Spring
相關(guān)文章:
主站蜘蛛池模板: 免费在线观看中日高清生活片 | 性插影院 | 免费一区二区三区视频狠狠 | 综合国产 | 国产精品精品视频 | 在线观看国产小屁孩cao大人 | 国产综合91 | 国产伦精品一区二区三区在线观看 | 国产综合久久久久久 | 久久在线精品视频 | 免费国产h视频在线观看86 | 午夜人成| 免费看片免费播放 | 亚洲一区二区三区四区在线观看 | 夜色在线影院 | 免黄网站 | 国产91精品久久久久久 | 黄色一级片中国 | 国产99精品一区二区三区免费 | 看日本真人一一级特黄毛片 | 亚洲综合图 | 国产人在线成免费视频麻豆 | 国产精品玖玖玖影院 | 美女被啪到深处喷水gif动态图视频 | 99久久免费国产精品 | 97菊爱网| 日韩欧美一区黑人vs日本人 | 亚洲精品资源在线 | 亚洲最大情网站在线观看 | 青春草在线视频精品 | 久久夜夜操妹子 | 污香蕉视频在线观看 | 青青青草网站免费视频在线观看 | 婷婷亚洲综合五月天小说在线 | 亚洲欧美一区二区三区在饯 | 99久久精品免费观看区一 | 妖精视频免费入口 | 成人国产精品久久久免费 | 国语一级毛片私人影院 | 日本a及毛片免费视频 | 久久久亚洲精品国产 |