Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove "Using default security password" on Spring Boot

I added one custom Security Config in my application on Spring Boot, but the message about "Using default security password" is still there in LOG file.

Is there any to remove it? I do not need this default password. It seems Spring Boot is not recognizing my security policy.

@Configuration @EnableWebSecurity public class CustomSecurityConfig extends WebSecurityConfigurerAdapter {      private final String uri = "/custom/*";      @Override     public void configure(final HttpSecurity http) throws Exception {         http.csrf().disable();         http.headers().httpStrictTransportSecurity().disable();         http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS);          // Authorize sub-folders permissions         http.antMatcher(uri).authorizeRequests().anyRequest().permitAll();     } } 
like image 410
Carlos Alberto Avatar asked Jun 10 '15 15:06

Carlos Alberto


People also ask

How do I disable spring boot default security?

In Spring Boot 2, if we want our own security configuration, we can simply add a custom WebSecurityConfigurerAdapter. This will disable the default auto-configuration and enable our custom security configuration.

How do I change my default Spring Security password?

To configure the default username, password and role, open application. properties file of your Spring Boot project and add the following three properties with the values you prefer. The above properties will change the default username, password and role.


1 Answers

I found out a solution about excluding SecurityAutoConfiguration class.

Example:

@SpringBootApplication(exclude = {SecurityAutoConfiguration.class }) public class ReportApplication {      public static void main(String[] args) throws Exception {         SpringApplication.run(MyApplication.class, args);     } } 
like image 91
Carlos Alberto Avatar answered Sep 19 '22 19:09

Carlos Alberto