国产成人精品久久免费动漫-国产成人精品天堂-国产成人精品区在线观看-国产成人精品日本-a级毛片无码免费真人-a级毛片毛片免费观看久潮喷

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

解析spring cloud ouath2中的Eureka

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

看到這眼熟不呢 沒錯(cuò) Eureka也開啟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)下圖 需要填寫賬號(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)文章:
主站蜘蛛池模板: 国产上床视频 | 欧美毛片a级毛片免费观 | 中文字幕乱码中文乱码51精品 | 亚洲欧美视频 | 亚洲 欧美 国产 中文 | 亚洲天堂小视频 | 性欧美高清久久久久久久 | 午夜性爽快免费视频播放 | 日本久草视频 | 亚洲成人偷拍自拍 | 国产日韩亚洲欧美 | 国产日韩久久久精品影院首页 | 综合九九| 手机在线亚洲 | 成年人免费观看网站 | 欧美日本一区二区 | 久久成人免费播放网站 | 毛片免费大全 | 日韩精品亚洲人成在线观看 | 99国产精品欧美久久久久久影院 | 香蕉久久精品 | 亚洲美女aⅴ久久久91 | 色怡红院| 免费观看一区二区 | 欧美一级片 在线播放 | 午夜精品网 | 亚洲精品综合一区二区三区在线 | 亚洲一区二区三区一品精 | 97精品在线视频 | 性a视频| 欧美巨大精品欧美一区二区 | 欧美一级毛片一级 | 精品久久久久久免费影院 | 男人好大好硬好爽免费视频 | 国产精品欧美一区二区 | 国产高清厕所盗摄视频 | 中文一级毛片 | 久久91精品国产91久久小草 | 日本精品夜色视频一区二区 | 欧美大屁股精品毛片视频 | 亚洲第一免费视频 |