The problem is that I am trying to set the management port for the springboot actuator to 9091, but it always stays on the application port, in this case 6421, I have tried several documentations that I have found, but they do not work, this is my configuration (I have omitted some values):
server:
port: 6421
connection-timeout: 10000
servlet:
context-path: /stack
tomcat:
uri-encoding: UTF-8
max-threads: 20
max-connections: 20
accept-count: 20
min-spare-threads: 1
graceful-shutdown-wait-seconds: 25
es:
company:
utils:
audit:
request-response:
enabled: true
properties:
application: ${spring.application.name}
exclude-url-patterns:
- /actuator/**
- /swagger-ui.html
- /webjars/**
- /v2/api-docs
- /csrf
spring:
jackson:
time-zone: Europe/Madrid
mapper:
accept-case-insensitive-enums: true
deserialization:
accept-single-value-as-array: true
serialization:
write-dates-as-timestamps: false
date-format: ${app.api.date-format}
application:
name: someone-management
cloud:
kubernetes:
config:
name: ${spring.application.name}
namespace: stackOverflow-dev
enabled: true
enableApi: true
data:
rest:
base-path: /api
###########################
# Management and monitoring
###########################
management:
port: 9091
endpoints:
web:
base-path: /
exposure:
include: info, health, metrics, prometheus, loggers
endpoint:
health:
show-details: always
security:
enabled: false
In itself, the rest of the properties are being applied correctly, since I can change the path or the endpoints that are shown, but the port never changes.
I also have a configuration bean but I haven't found a way to modify it around here:
@Configuration
@Slf4j
public class PrometheusCustomConfig {
@Value("${spring.application.name}")
private String appName;
@Bean
MeterRegistryCustomizer<MeterRegistry> metricsCommonTags() {
return registry -> registry.config()
.commonTags("application", appName);
}
}
Does anyone know how to fix it? Thanks.
You're possibly using the wrong version of the documentation (and you don't include the pom in your question, so we had to guess.
For 2.x that property is set to
management.server.port
And you seem to be using the Actuator 1.x configuration.