Ed JG
Ed JG

Reputation: 21

required a bean of type 'de.codecentric.boot.admin.server.config.AdminServerProperties' that could not be found

i am having this issue of

required a bean of type "de.codecentric.boot.admin.server.config.AdminServerProperties" that could not be found

Consider defining a bean of type "de.codecentric.boot.admin.server.config.AdminServerProperties" in your configuration.

here is my POM

<dependencies>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-security</artifactId>
    </dependency>

    <!--Add login page and logout feature -->
    <dependency>
        <groupId>de.codecentric</groupId>
        <artifactId>spring-boot-admin-starter-server</artifactId>
        <version>2.2.2</version>
    </dependency>
    <dependency>
        <groupId>de.codecentric</groupId>
        <artifactId>spring-boot-admin-server</artifactId>
        <version>2.2.2</version>
    </dependency>
    <dependency>
        <groupId>de.codecentric</groupId>
        <artifactId>spring-boot-admin-server-ui</artifactId>
        <version>2.2.2</version>
    </dependency>
    <!--Add login page and logout feature -->
    <dependency>
        <groupId>de.codecentric</groupId>
        <artifactId>spring-boot-admin-server-ui-login</artifactId>
        <version>1.5.7</version>
    </dependency>
    <dependency>
        <groupId>com.hazelcast</groupId>
        <artifactId>hazelcast</artifactId>
    </dependency>
    <!--declare the admin server as a client, for self monitoring -->
    <dependency>
        <groupId>de.codecentric</groupId>
        <artifactId>spring-boot-admin-starter-client</artifactId>
        <version>2.2.2</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
        <exclusions>
            <exclusion>
                <groupId>org.junit.vintage</groupId>
                <artifactId>junit-vintage-engine</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-test</artifactId>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.11</version>
        <scope>test</scope>
    </dependency>
</dependencies>

any idea what is the cause?

public class WebSecurityConfig extends WebSecurityConfigurerAdapter {

private final AdminServerProperties adminServer;

public WebSecurityConfig(AdminServerProperties adminServer) {
    this.adminServer = adminServer;
}

Upvotes: 1

Views: 2633

Answers (1)

Volodymyr Mankivskyi
Volodymyr Mankivskyi

Reputation: 21

It will be enough add @Import(AdminServerProperties.class) above the main class (@SpringBootApplication)

Upvotes: 2

Related Questions