Marcel
Marcel

Reputation: 146

Running Spring Boot Admin with a non-default port

I want to start the Spring Boot Admin server on a different port than 8080. So I configured the server.port property in the bootstrap.yml file with 9000, but still the server listens on port 8080 according to the log file. Here's my bootstrap.yml:

server:
  port: 9000

spring:
  application:
    name: admin-server
  cloud:
    config:
      uri: http://localhost:8888

And this is the final part of the console log:

2018-11-29 15:52:11.242  INFO 25999 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2018-11-29 15:52:11.271  INFO 25999 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2018-11-29 15:52:11.274  INFO 25999 --- [           main] n.d.d.c.a.AdminServerApplication         : Started AdminServerApplication in 2.826 seconds (JVM running for 3.355)
2018-11-29 15:52:11.818  INFO 25999 --- [on(4)-127.0.0.1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring FrameworkServlet 'dispatcherServlet'
2018-11-29 15:52:11.819  INFO 25999 --- [on(4)-127.0.0.1] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization started
2018-11-29 15:52:11.830  INFO 25999 --- [on(4)-127.0.0.1] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization completed in 11 ms

Upvotes: 0

Views: 2930

Answers (3)

Marcel
Marcel

Reputation: 146

A flashlight in my brain told me I might have forgotten to add the spring-cloud-config-client dependency, after checking, and then adding the appropriate dependency to the pom.xml, it worked like a charm:

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-config-client</artifactId>
</dependency>

Thanks to all for providing feedback.

Upvotes: 2

Gustavo Passini
Gustavo Passini

Reputation: 2668

Many different configuration sources have precedence over application.properties (or YAML) as described here: https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html

You might need to verify if one of those sources are not interfering with the value of serve.port.

Upvotes: 0

Jose
Jose

Reputation: 124

In the application.properties file put this

server.port = 9000

Upvotes: 2

Related Questions