@Bean
    @ConditionalOnMissingBean
    UserDetailsService userDetailsService() {
        final InMemoryUserDetailsManager inMemoryUserDetailsManager = new InMemoryUserPrincipalDetailsManager();
        inMemoryUserDetailsManager.setAuthenticationManager(null);
        final SecurityProperties.User user = securityProperties.getUser();
        final UserBuilder userBuilder = User.builder().username(user.getName()).password(user.getPassword())
                .authorities(PermissionUtils.createAllAuthorityList());
        final List<String> roles = user.getRoles();
        if (!roles.isEmpty()) {
            userBuilder.roles(roles.toArray(new String[roles.size()]));
        }
        inMemoryUserDetailsManager.createUser(userBuilder.build());
        return inMemoryUserDetailsManager;
    }
@ Bean @ ConditionalOnMissingBean UserDetailsService userDetailsService ( ) { final InMemoryUserDetailsManager inMemoryUserDetailsManager = new InMemoryUserPrincipalDetailsManager ( ) ; inMemoryUserDetailsManager . setAuthenticationManager ( null ) ; final SecurityProperties . User user = securityProperties . getUser ( ) ; final UserBuilder userBuilder = User . builder ( ) . username ( user . getName ( ) ) . password ( user . getPassword ( ) ) . authorities ( PermissionUtils . createAllAuthorityList ( ) ) ; final List < String > roles = user . getRoles ( ) ; if ( ! roles . isEmpty ( ) ) { userBuilder . roles ( roles . toArray ( new String [ roles . size ( ) ] ) ) ; } inMemoryUserDetailsManager . createUser ( userBuilder . build ( ) ) ; return inMemoryUserDetailsManager ; }
@return the user details service to load a user from memory user manager.