@ EventListener public void init ( ContextRefreshedEvent event ) { idTokenFactory = context . getBean ( IdTokenFactory . class ) ; // Make sure we have a guestUsernameSelectors collection & sort it if ( guestUsernameSelectors == null ) { guestUsernameSelectors = Collections . emptyList ( ) ; } Collections . sort ( guestUsernameSelectors ) ; }
To avoid circular reference issues this bean obtains its dependencies when the context finishes starting .