While starting Spring Boot Application I am getting this error:
The following classes could not be excluded because they are not auto-configuration classes:
- org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration
This is how my application looks like. I have excluded WebsecurityConfiguration.class
from EnablEAutoConfiguration
but I keep on getting the above error. If I remove WebsecurityConfiguration.class
from exclude my application is not able to get properties from application.yaml
. Can you please help me in resolving this issue?
@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 {
}
In the entry point for your SpringBoot app, use the following:
@SpringBootApplication
@ComponentScan(excludeFilters={@ComponentScan.Filter(type= FilterType.ASSIGNABLE_TYPE, value=<classThatYouWantToExclued>.class)})
public class TestApplication {
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