We are trying to migrate our application to Spring Boot 3+ version, with Spring Security 6+. Our project depends on a library (oauth2), which uses Spring Boot 2+ version with WebSecurityConfigurerAdapter and other deprecated staff. We cannot change the library and when we start the application we are getting:
Caused by: java.io.FileNotFoundException: class path resource [org/springframework/security/config/annotation/web/configuration/WebSecurityConfigurerAdapter.class] cannot be opened because it does not exist
Is that possible to use Spring Security 6+ on our project without changing the library?
My answer would have been more helpful if you had specified what this lib is and if you had provided your security conf, but to this question, all we can answer is: no, you can't use a lib written for Spring Security 5 in a project with Spring Security 6.
This is a very frequent question from users of the Keycloak adapters for Spring and the answer is to remove this dependency and to write the security conf yourself (or to use another lib with similar features and compatible with security 6).
As exposed in my answer to using Keycloak with Boot 3, writing such conf can be rather simple.