ApplicationContext applicationContext = WebApplicationContextUtils
.getWebApplicationContext(request.getSession()
.getServletContext());
PostTypeService postTypeService = (PostTypeService) applicationContext
.getBean("postTypeService");
PostService postService = (PostService) applicationContext
.getBean("postService");
List<Post> postList = null;
List<PostType> postTypeList = null;
try {
postList = postService.findAllPost();
postTypeList = postTypeService.findAllPostType();
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}