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

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

解析spring cloud ouath2中的Eureka

瀏覽:84日期: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

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

@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>

當訪問localhost:7001 出現(xiàn)下圖 需要填寫賬號密碼

解析spring cloud ouath2中的Eureka

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

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)!

標簽: Spring
相關(guān)文章:
主站蜘蛛池模板: 国产精品美乳免费看 | 1000部未满岁18在线观看污 | 日韩在线中文 | 日韩黄毛片 | 日韩美女人体视频免费播放 | 日本一级特级毛片视频 | 精品国产一区二区三区久久 | 久久成人国产精品二三区 | 国产成人91精品 | 香蕉视频免费在线观看 | 2020国产成人免费视频 | 伊人网综合在线观看 | a级午夜理论免费毛片 | 在线观看91香蕉国产免费 | 国产v在线在线观看羞羞答答 | 免费国产午夜在线观看 | 一级毛片不卡片免费观看 | 国产精品自拍一区 | 精品国产高清自在线一区二区三区 | 黄色毛片前黄 | 国产乱码在线精品可播放 | 亚洲偷图色综合色就色 | bdsm中国精品调教 | 91大神大战酒店翘臀美女 | 三级黄色片a| 国产大量情侣高清视频 | 美女黄页在线观看 | 日本一级毛片免费完整视频2020 | 国产超薄肉色丝袜的免费网站 | 在线播放一区二区精品产 | 成人免费激情视频 | 亚洲综合狠狠 | 国产成人精品久久二区二区 | 中文字幕一区二区三区精彩视频 | 国产成人精品视频 | 女人被狂躁的免费视频网站软件 | 亚洲精品一区二区乱码在线观看 | 日韩精品亚洲专区在线影视 | 久久视屏这里只有精品6国产 | 国产一区在线观看视频 | 男女爽插视频 |