I was trying out the following example in
and it works fine without any errors in Intellij IDEA. But as soon as I change the Spring Boot version from 2.4.4 to 2.7.1 in pom.xml, it throws an IDE error:
Could not autowire. No beans of 'HttpSecurity' type found for the following:
@Bean
public SecurityFilterChain configuration(HttpSecurity httpSecurity) throws Exception {
..........................
The application works fine but would be interested to know why this is happening. Version of IDE is IntelliJ IDEA 2022.1 (Ultimate Edition)
For some reason, the IDE cannot detect that the HttpSecurity
bean is configured by Spring Boot. You can get rid of the error by adding @EnableWebSecurity
to your configuration class, it solves it because the annotation imports the HttpSecurityConfiguration
configuration class.
The IntelliJ team has fixed this problem, you can get more information about the fix and which version it is available here.
Available in IntelliJ 2022.2 EAP 3, 2022.1.3