The bean 'metaDataSourceAdvisor', defined in null, could not be registered

后端 未结 3 1561
栀梦
栀梦 2020-12-16 09:30

I\'ve updated the Spring Boot version from 2.0.3 to 2.1.1 but I\'m getting this:

***************************
APPLICATION FAILED TO START
********************         


        
3条回答
  •  时光说笑
    2020-12-16 09:55

    Okay, I found the issue myself: I had @EnableGlobalMethodSecurity twice in my project:

    @Configuration
    @EnableWebSecurity
    @EnableGlobalMethodSecurity(prePostEnabled = true) // <--
    public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
    }
    

    and

    @SpringBootApplication
    @EnableJpaRepositories(basePackages = {"mz.server.spring.repository"})
    @EnableGlobalMethodSecurity(prePostEnabled = true, proxyTargetClass = true) // <--
    @EntityScan(basePackages = "mz.server.hibernate.model")
    @EnableTransactionManagement
    @EnableScheduling
    public class Application {
    }
    

    So that's a nice new Spring Boot feature I'd say.

    Just watch out for unwanted duplicate annotations if you see this kind of error.

提交回复
热议问题