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

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

解析spring cloud ouath2中的Eureka

瀏覽:92日期: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
相關文章:
主站蜘蛛池模板: 男操美女 | 色综合色狠狠天天久久婷婷基地 | 国产精品三级在线观看 | 午夜精品久久久久久99热7777 | 男女同床爽爽视频免费 | 视频一区免费 | 免费看欧美一级特黄a毛片 免费看片aⅴ免费大片 | 国产精品一区在线免费观看 | 在线亚洲欧美日韩 | japanese 色系 tube日本 | 日本手机看片 | 欧美黑人巨大最猛性xxxxx | 亚洲成a人在线观看 | 日本加勒比视频 | 欧美日韩高清观看一区二区 | 无国产精品白浆是免费 | 日本欧美三级 | 国产成人精品视频免费 | 国产三级午夜理伦三级 | 午夜毛片免费观看视频 | 扒开双腿猛进入喷水免费视频 | 久久久久久国产精品免费免 | 日本精品国产 | 手机看片在线精品观看 | 久久99国产精品视频 | 一区在线免费观看 | 三级视频网站在线观看播放 | 成人香蕉视频 | 国产在线精品观看 | 久草在线在线 | 992人人tv香蕉国产精品 | 欧美aaaaa一级毛片在线 | 免费岛国小视频在线观看 | 国产乱色在线观看 | 国产午夜精品不卡观看 | 亚洲最新 | 成年人视频在线免费播放 | 精品厕拍 | 日韩欧美国产另类 | 欧美三级一区二区 | 毛片免费观看视频 |