bootlover123
bootlover123

Reputation: 131

Getting 404 when access spring admin

I have a very simple app:

This is my main class:

@EnableAdminServer
@Configuration
@SpringBootApplication
public class DemoApplication {
    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }
}

And this is my pom.xml which is showing the dependency and parent tags:

    <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.4.9</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<properties>
    <java.version>11</java.version>
    <spring-boot-admin.version>2.3.1</spring-boot-admin.version>
</properties>
<dependencies>
    <dependency>
        <groupId>de.codecentric</groupId>
        <artifactId>spring-boot-admin-starter-server</artifactId>
        <version>2.3.1</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
</dependencies>

And my properties file:

management.endpoints.web.exposure.include=*
management.endpoint.health.show-details=always
server.port = 9090
spring.application.name = adminserver

And now all the tutorials i've come across, they say simply adding the @EnableAdminServer should be enough set up the server. But when i go onto localhost:9090/admin, it results in a 404. I can go to the /actuator endpoint and see ?

Upvotes: 2

Views: 914

Answers (2)

Kartik Pandey
Kartik Pandey

Reputation: 1

For me I have used @EnableAdminServer before @SpringBootApplication this was causing the issue I have changed the order and it worked

Upvotes: 0

SANN3
SANN3

Reputation: 10099

The admin URL will be http://localhost:9090 not localhost:9090/admin

Upvotes: 2

Related Questions