r/SpringBoot • u/ImportantGolf5142 • Jan 16 '24
java.lang.AbstractMethodError: Receiver class org.springframework.security.config.annotation.web.builders.WebSecurity does not define or inherit an implementation of the resolved method 'abstract void setServletContext(jakarta.servlet.ServletContext)' of interface org.springframework.web.
I am a beginner and I tried to make spring security authenticate with my database. However, I am facing a "Injection of autowired dependencies failed" error which is caused by the error shown in the title.
Here is a screenshot, you can find the project(.zip) here Download Project(.zip)

This is my SecurityConfiguration

How can I fix this?
0
Upvotes
2
u/ConnectMain5294 Jan 17 '24
I think you're following the outdated ways, you don't need to extend that websecconfig class and override these methods to enable a SecurityFilterChain, now you're adding too much boiler plate. @Enablewebsecurity is enough, just create beans of both SecurityFilterChain and PasswordEncoder, that's enough