/** * 重新加载UserDetails * * @param username * @param request */ public static void reloadUserDetails(String username, HttpServletRequest request) { UserDetailServiceImpl userDetailServiceImpl = ContextManager.getApplicationContext().getBean(UserDetailServiceImpl.class); UserDetails userDetails = userDetailServiceImpl.loadUserByUsername(username); PreAuthenticatedAuthenticationToken authentication = new PreAuthenticatedAuthenticationToken( userDetails, userDetails.getPassword(), userDetails.getAuthorities()); if (request != null) { authentication.setDetails(new WebAuthenticationDetails(request)); } SecurityContextHolder.getContext().setAuthentication(authentication); }
public static DataSource getDataSource() { return (DataSource) ContextManager.getApplicationContext().getBean("dataSource"); }
public static PostSearchService getPostSearchService() { return ContextManager.getApplicationContext().getBean(PostSearchService.class); }
public static JdbcTemplate getJdbcTemplate() { return ContextManager.getApplicationContext().getBean(JdbcTemplate.class); }
public static ExtendsFreeMarkerConfigurer getExtendsFreeMarkerConfigurer() { return ContextManager.getApplicationContext().getBean(ExtendsFreeMarkerConfigurer.class); }
public static FileService getFileService() { return ContextManager.getApplicationContext().getBean(FileService.class); }
public static StatService getStatService() { return ContextManager.getApplicationContext().getBean(StatService.class); }
public static CommentService getCommentService() { return ContextManager.getApplicationContext().getBean(CommentService.class); }
public static CatalogService getCatalogService() { return ContextManager.getApplicationContext().getBean(CatalogService.class); }
public static OptionService getOptionService() { return ContextManager.getApplicationContext().getBean(OptionService.class); }
public static UserService getUserService() { return ContextManager.getApplicationContext().getBean(UserService.class); }