Spring Security Test 4.1.0 changes the order of `WithSecurityContextTestExecutionListener`
See original GitHub issueI updated an app I develop to Spring Boot 1.4.0.RC1.
Since the update to Spring Security Test 4.1.0 the order of WithSecurityContextTestExecutionListener
is now implemented with the Ordered
interface instead of @Order
, see https://github.com/spring-projects/spring-security/issues/2933.
I understand the order did not work as intended before this bugfix. But now that it is evaluated the behaviour of some of my tests changes so they break. SqlScriptsTestExecutionListener
has a priority of 5000, so it is executed after the security listener. I load the Spring Security users into the database via @Sql
and set them on test methods via @WithUserDetails
, but this is now broken because the SQL files are not evaluated yet (so I get a UsernameNotFoundException
).
I’m not sure where to report this, I guess this is not a bug or a question. But maybe it helps other people to understand this problem as well. For now I don’t have a good migration solution to circumvent this.
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (6 by maintainers)
Can confirm it works now.
@FrontierPsychiatrist Just as an FYI, Spring Security 4.1.1.RELEASE is available in Maven Central and resolves this.