97ee6d66f1
Currently, there is support for setting up a SecurityContext after @Before by using TestExecutionEvent.TEST_EXECUTION. The current implementation, however, already creates the SecurityContext in @Before and just does not set it yet. This leads to issues like #6591. For the case of @WithUserDetails, the creation of the SecurityContext already looks up a user from the repository. If the user was inserted in @Before, the user is not found despite using TestExecutionEvent.TEST_EXECUTION. This commit changes the creation of the SecurityContext to happen after @Before if using TestExecutionEvent.TEST_EXECUTION. Closes gh-6591