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

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

解析spring cloud ouath2中的Eureka

瀏覽:172日期: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 在訪問前臺(tái)頁面時(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)密碼 在訪問頁面需要輸入的

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)下圖 需要填寫賬號(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)文章:
主站蜘蛛池模板: 日韩美女中文字幕 | 日韩在线第一 | 中文在线资源 | 日韩综合一区二区三区 | 欧洲在线观看 | 国产精品男女 | 日韩色图在线观看 | 精品成人一区二区三区 | 福利网站在线观看 | 日韩av一二三 | 亚洲美女一区二区三区 | 欧美日韩在线视频免费观看 | 欧美黄色大片网站 | 麻豆视频免费在线 | 成人av图片 | 日韩精品一区二区三区在线 | 91丨porny丨刺激 | 天堂网中文在线观看 | www在线看 | 日韩中出 | 久久久免费高清视频 | 中文字幕免费在线播放 | 午夜视频黄 | 欧美成人精品一区二区三区在线看 | 日韩午夜免费 | 亚洲激情视频网 | 欧美午夜理伦三级在线观看 | 中文字幕国产专区 | 深夜精品福利 | 最新免费av | 中文激情网| 黄色片网站在线播放 | 亚洲高潮av | 久久亚洲网 | 在线免费中文字幕 | 日韩中文字幕免费视频 | 欧美第七页 | 亚洲手机av | 免费一二区 | 天天天天天天天操 | 日韩av女优在线观看 |