Skip to content

Commit 25a55bc

Browse files
author
Hüseyin Öcal
committed
Actuator added to usersmicroservice and apigateway
1 parent 50e7c5d commit 25a55bc

File tree

8 files changed

+34
-4
lines changed

8 files changed

+34
-4
lines changed

apigateway/pom.xml

+5
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@
5555
<artifactId>spring-cloud-starter-bus-amqp</artifactId>
5656
</dependency>
5757

58+
<dependency>
59+
<groupId>org.springframework.boot</groupId>
60+
<artifactId>spring-boot-starter-actuator</artifactId>
61+
</dependency>
62+
5863
<dependency>
5964
<groupId>org.springframework.boot</groupId>
6065
<artifactId>spring-boot-devtools</artifactId>

apigateway/src/main/java/huseyin/ocal/apigateway/security/SecurityConstants.java

+3
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,7 @@ public class SecurityConstants {
77
public static final String H2CONSOLE = "users-ws/root/status";
88
public static final String REGISTRATION = "/users-ws/root/users";
99
public static final String LOGIN = "/users-ws/login";
10+
public static final String ACTUATOR = "/actuator/*";
11+
public static final String USERACTUATOR = "users-ws/actuator/*";
12+
1013
}

apigateway/src/main/java/huseyin/ocal/apigateway/security/WebSecurity.java

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ protected void configure(HttpSecurity http) throws Exception {
2020
http.csrf().disable();
2121
http.headers().frameOptions().disable();
2222
http.authorizeRequests()
23+
.antMatchers(SecurityConstants.USERACTUATOR).permitAll()
24+
.antMatchers(SecurityConstants.ACTUATOR).permitAll()
2325
.antMatchers(SecurityConstants.H2CONSOLE).permitAll()
2426
.antMatchers(HttpMethod.POST, SecurityConstants.REGISTRATION).permitAll()
2527
.antMatchers( HttpMethod.POST, SecurityConstants.LOGIN).permitAll()

apigateway/src/main/resources/application.properties

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@ eureka.client.service-url.defaultZone=http://localhost:8010/eureka
55
spring.rabbitmq.host=localhost
66
spring.rabbitmq.port=5672
77
spring.rabbitmq.username=guest
8-
spring.rabbitmq.password=guest
8+
spring.rabbitmq.password=guest
9+
10+
management.endpoints.web.exposure.include=beans,health,routes,httptrace

apigateway/src/main/resources/application.yaml

+8-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ eureka:
1313
client:
1414
service-url:
1515
defaultZone: http://localhost:8010/eureka
16-
web
16+
web:
1717
security:
1818
status: users-ws/root/status
1919
registration: /users-ws/root/users
@@ -23,4 +23,10 @@ web
2323
token_secret: hfgry463hf746hf573ydh475fhy5739
2424
# xxx:
2525
# axxx: something
26-
# bxxx: another sth
26+
# bxxx: another sth
27+
management:
28+
endpoint:
29+
endpoints:
30+
web:
31+
exposure:
32+
include: bean, health, routes ,httptrace

usersmicroservice/pom.xml

+5
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@
9191
<artifactId>spring-cloud-starter-bus-amqp</artifactId>
9292
</dependency>
9393

94+
<dependency>
95+
<groupId>org.springframework.boot</groupId>
96+
<artifactId>spring-boot-starter-actuator</artifactId>
97+
</dependency>
98+
9499
<dependency>
95100
<groupId>org.springframework.boot</groupId>
96101
<artifactId>spring-boot-starter-test</artifactId>

usersmicroservice/src/main/resources/application.properties

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,6 @@ login.url.path=/login
1818
spring.rabbitmq.host=localhost
1919
spring.rabbitmq.port=5672
2020
spring.rabbitmq.username=guest
21-
spring.rabbitmq.password=guest
21+
spring.rabbitmq.password=guest
22+
23+
management.endpoints.web.exposure.include=mappings

usersmicroservice/src/main/resources/application.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,8 @@ web:
4242
expiration_time: 864000000
4343
token_secret: hfgry463hf746hf573ydh475fhy5739
4444
login: /login
45+
management:
46+
endpoints:
47+
web:
48+
exposure:
49+
include: mappings

0 commit comments

Comments
 (0)