Remove “Using default security password” on Spring Boot

后端 未结 18 2178
小鲜肉
小鲜肉 2020-12-04 12:13

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 a

18条回答
  •  抹茶落季
    2020-12-04 12:21

    If you are declaring your configs in a separate package, make sure you add component scan like this :

    @SpringBootApplication
    @ComponentScan("com.mycompany.MY_OTHER_PACKAGE.account.config")
    
        public class MyApplication {
    
            public static void main(String[] args) {
                SpringApplication.run(MyApplication.class, args);
            }
    
    
    
        }
    

    You may also need to add @component annotation in the config class like so :

      @Component
    @EnableWebSecurity
    public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
    
        @Override
        protected void configure(HttpSecurity http) throws Exception {
            http
                .authorizeRequests()
    
    .....
    
    1. Also clear browser cache and run spring boot app in incognito mode

提交回复
热议问题