diff --git a/sc-config/src/main/resources/application.yml b/sc-config/src/main/resources/application.yml index 375e1c3..904f843 100644 --- a/sc-config/src/main/resources/application.yml +++ b/sc-config/src/main/resources/application.yml @@ -1,12 +1,12 @@ server: port: 8800 spring: -# security: -# basic: -# enabled: true -# user: -# name: root -# password: booszy + security: + basic: + enabled: true + user: + name: root + password: booszy application: name: springcloud-config-server cloud: @@ -21,6 +21,7 @@ eureka: defaultZone: http://root:booszy@localhost:8761/eureka/ instance: prefer-ip-address: true - instance-id: ${spring.application.name}:${spring.cloud.client.ipAddress}:${spring.application.instance_id:${server.port}} +# instance-id: ${spring.application.name}:${spring.cloud.client.ip_address}:${spring.application.instance_id:${server.port}} + instance-id: ${spring.application.name}:${spring.application.instance_id:${server.port}} appname: springcloud-config-server diff --git a/sc-eureka/src/main/java/com/trgis/sb2sc/config/WebSecurityConfig.java b/sc-eureka/src/main/java/com/trgis/sb2sc/config/WebSecurityConfig.java new file mode 100644 index 0000000..6389459 --- /dev/null +++ b/sc-eureka/src/main/java/com/trgis/sb2sc/config/WebSecurityConfig.java @@ -0,0 +1,15 @@ +package com.trgis.sb2sc.config; + +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; + +@EnableWebSecurity +class WebSecurityConfig extends WebSecurityConfigurerAdapter { + + @Override + protected void configure(HttpSecurity http) throws Exception { + http.csrf().ignoringAntMatchers("/eureka/**"); + super.configure(http); + } +} \ No newline at end of file diff --git a/sc-eureka/src/main/resources/application.yml b/sc-eureka/src/main/resources/application.yml index f17c41a..f508cce 100644 --- a/sc-eureka/src/main/resources/application.yml +++ b/sc-eureka/src/main/resources/application.yml @@ -7,7 +7,7 @@ eureka: # 关闭自我保护 enable-self-preservation: false # 清理服务器 - eviction-interval-timer-in-ms: 30000 + eviction-interval-timer-in-ms: 5000 client: healthcheck: enabled: true