Search code examples
javaspring-bootspring-boot-admin

About spring-boot-admin ,Client configuration


I am reading the official manual in an attempt to build a v2.0.1 spring-boot-admin project.When I compiled the project, an error occurred.

"Error:(17, 23) java: Unable to access javax.servlet.Filter Could not find the class file for javax.servlet.Filter"

I am trying to add a new dependency to prevent this error from occurring. But it was not successful.

This is my configuration code, ask me how to do it to make the client start normally. My code

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;

@SpringBootApplication

public class Adminclient21Application {

    public static void main(String[] args) {
        SpringApplication.run(Adminclient21Application.class, args);
    }
    @Configuration
    public static class SecurityPermitAllConfig extends WebSecurityConfigurerAdapter {
        @Override
        protected void configure(HttpSecurity http) throws Exception {
            http.authorizeRequests().anyRequest().permitAll()
                    .and().csrf().disable();
        }
    }
}

Solution

  • Try adding dependency, I got the same error, resolved after adding the below

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