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(); } }
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.
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.
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); } }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With