久久福利_99r_国产日韩在线视频_直接看av的网站_中文欧美日韩_久久一

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

解析spring cloud ouath2中的Eureka

瀏覽:102日期: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)文章:
主站蜘蛛池模板: 免费在线观看毛片网站 | 日韩在线永久免费播放 | 99爱在线观看 | 粉嫩高清一区二区三区精品视频 | 国产片网站 | 天堂伊人网 | av黄在线观看 | 亚洲精品午夜视频 | 久久国产精品久久精品 | 午夜av在线 | 欧美日韩国产综合视频 | 99久久久国产精品 | 麻豆精品久久 | 国产成人精品免高潮在线观看 | 国产欧美一区二区三区在线看 | 毛片久久| 国产亚洲视频在线观看 | 国产精品久久嫩一区二区免费 | 91国内产香蕉 | 国产黄色一级大片 | 精品久久久久久亚洲精品 | 久久se精品一区精品二区 | 欧美一区二区三区免费电影 | 在线观看成人网 | 偷拍做爰吃奶视频免费看 | 亚洲国产精品人人爽夜夜爽 | 毛片网站在线 | 欧美国产视频 | 久久久久久久99精品免费观看 | 久久久久久亚洲精品 | 国产精品一区在线观看你懂的 | 久久精品免费一区二区三区 | 久久国产精品视频 | 国产精品一区二区在线 | 国产激情性色视频在线观看 | 国产精品久久精品久久 | 欧美成人一区二区三区片免费 | 亚洲一区二区三区爽爽爽爽爽 | 亚州中文字幕蜜桃视频 | 最近免费中文字幕大全免费版视频 | 精品成人一区二区 |