gpt4 book ai didi

java - 如何解决错误 "The following classes could not be excluded because they are not auto-configuration classes"?

转载 作者:行者123 更新时间:2023-12-04 04:02:14 24 4
gpt4 key购买 nike

在启动 Spring Boot 应用程序时,我收到此错误:

The following classes could not be excluded because they are not auto-configuration classes:
- org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration
这就是我的应用程序的样子。我已排除 WebsecurityConfiguration.class来自 EnablEAutoConfiguration但我不断收到上述错误。如果我删除 WebsecurityConfiguration.class from exclude 我的应用程序无法从 application.yaml 获取属性.你能帮我解决这个问题吗?
@Configuration
@EnableAutoConfiguration(exclude = { DataSourceAutoConfiguration.class, SecurityAutoConfiguration.class,
ManagementWebSecurityAutoConfiguration.class, WebSecurityConfiguration.class

})
// @ComponentScan("com.infy.ceh.management")
@ComponentScan(basePackages = "com.infy.ceh.management", excludeFilters = @Filter(type = FilterType.CUSTOM, value = {
ExcludeAnnotationFilter.class })

)
public class AgentApplication {

}

最佳答案

在 SpringBoot 应用程序的入口点中,使用以下内容:

@SpringBootApplication
@ComponentScan(excludeFilters={@ComponentScan.Filter(type= FilterType.ASSIGNABLE_TYPE, value=<classThatYouWantToExclued>.class)})
public class TestApplication {

关于java - 如何解决错误 "The following classes could not be excluded because they are not auto-configuration classes"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62910583/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com