Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

documentation: Application main class in getting-started.html #3291

Closed
belingueres opened this issue Apr 11, 2024 · 3 comments
Closed

documentation: Application main class in getting-started.html #3291

belingueres opened this issue Apr 11, 2024 · 3 comments

Comments

@belingueres
Copy link

Spring Boot Admin Server information

Client information

  • Spring Boot versions:
    3.2.3

  • Used discovery mechanism:
    SBA client

  • Webflux or Servlet application:
    do not apply

Description

I had a hard time configuring Security as in the documentation example.

In the https://docs.spring-boot-admin.com/current/getting-started.html:

The spring boot app main class is defined as:

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

but in order for the app to recognize the security config I needed to change @configuration for @SpringBootApplication:

@SpringBootApplication
@EnableAutoConfiguration
@EnableAdminServer
public class App {

  public static void main(String[] args) {
    SpringApplication.run(App.class, args);
  }

}
@erikpetzold
Copy link
Member

Hi @belingueres ,

the getting started docs contain a minimal configuration, but htere is also a grey box below pointing out that there is security in the servlet sample, which imports the security config in the Application class: @Import({ SecurityPermitAllConfig.class, SecuritySecureConfig.class, NotifierConfig.class }).

But we agree that these things will be much simpler with @SpringBootApplication, we will try to update the samples and the docs.

@belingueres
Copy link
Author

That seems to be the case: adding the @SpringBootApplication seems to auto-scan for the @configuration classes. Otherwise we have to explicitly @import each one of them.

@erikpetzold
Copy link
Member

The problem is that autoscanning finds too many configurations as the samples are in the same package as the admin itself. This will be changed here: #3297

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants