午夜剧场伦理_日本一道高清_国产又黄又硬_91黄色网战_女同久久另类69精品国产_妹妹的朋友在线

您的位置:首頁技術文章
文章詳情頁

解析spring cloud ouath2中的Eureka

瀏覽:180日期: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 出現下圖 需要填寫賬號密碼

解析spring cloud ouath2中的Eureka

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

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

到此這篇關于spring cloud ouath2中的Eureka的文章就介紹到這了,更多相關spring cloud ouath2內容請搜索好吧啦網以前的文章或繼續瀏覽下面的相關文章希望大家以后多多支持好吧啦網!

標簽: Spring
相關文章:
主站蜘蛛池模板: 欧美高清一区 | 高清一区二区 | 欧美激情综合色综合啪啪五月 | 97超级碰| 欧美色综合天天久久综合精品 | 欧美精品久久久久久久 | 黄色草逼视频 | 超碰免费人人 | h视频在线观看免费 | 国产精品v欧美精品v日韩 | 欧美精品亚洲精品 | 久久久久逼 | 精品乱子伦 | 中文字幕av一区 | 香蕉视频链接 | 亚洲天堂男人 | 精品免费在线视频 | 亚洲精品黄色 | 超碰94| 我要色综合网 | 国产免费片| 国产91在线播放精品91 | 欧美做受高潮6 | 日本欧美日韩 | 亚洲黄色a级片 | 欧美高清性xxxxhdvideosex | 91插插插影库永久免费 | 成人免费视频国产在线观看 | 国内自拍视频在线播放 | 中文字幕日韩三级 | 色站综合 | 国产精品人人 | 午夜天堂视频 | 日韩精品视频中文字幕 | 欧美精品久久久久久久久老牛影院 | 伊人久久久| 免费看成年人视频 | 日日夜夜干 | www久久久久久 | 日日夜夜精品视频免费 | 亚洲视频在线观看网站 |