spring cloud : e-commerce(user-service) - spring cloud config(actuator refresh)

This commit is contained in:
haerong22
2021-09-25 21:34:57 +09:00
parent 3bdb65635d
commit 8049af7d79
6 changed files with 27 additions and 7 deletions

View File

@@ -9,4 +9,5 @@ spring:
config:
server:
git:
uri: file://C:/Users/Woojin/Desktop/study/config
# uri: file://C:/Users/Woojin/Desktop/study/config
uri: file:///Users/bobby/Desktop/kim/study/config

View File

@@ -26,6 +26,10 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.cloud:spring-cloud-starter-config'
implementation 'org.springframework.cloud:spring-cloud-starter-bootstrap'
implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client'

View File

@@ -33,8 +33,11 @@ public class UserController {
@GetMapping("/health_check")
public String status() {
return String.format("It's working in User Service on PORT %s",
env.getProperty("local.server.port"));
return "It's working in User Service"
+ ", port(local.server.port)=" + env.getProperty("local.server.port")
+ ", port(server.port)=" + env.getProperty("server.port")
+ ", token secret=" + env.getProperty("token.secret")
+ ", token expiration time=" + env.getProperty("token.expiration_time");
}
@GetMapping("/welcome")

View File

@@ -31,8 +31,9 @@ public class WebSecurity extends WebSecurityConfigurerAdapter {
http.csrf().disable().headers().frameOptions().disable();
// http.authorizeRequests().antMatchers("/users/**").permitAll();
http.authorizeRequests().antMatchers("/actuator/**").permitAll();
http.authorizeRequests().antMatchers("/**")
.hasIpAddress("172.30.1.7")
.hasIpAddress("127.0.0.1")
.and()
.addFilter(getAuthenticationFilter());

View File

@@ -32,6 +32,12 @@ logging:
level:
com.example.userservice: DEBUG
token:
expiration_time: 86400000
secret: user_token
management:
endpoints:
web:
exposure:
include: refresh, health, beans
#token:
# expiration_time: 86400000
# secret: user_token

View File

@@ -0,0 +1,5 @@
spring:
cloud:
config:
uri: http://127.0.0.1:8888
name: ecommerce