*/
public void init(ServletConfig config) throws ServletException {
System.out.println("inti");
ApplicationContext applicationContext = WebApplicationContextUtils
.getWebApplicationContext(config.getServletContext());
PostTypeService postTypeService = (PostTypeService) applicationContext
.getBean("postTypeService");
OptionService optionService = (OptionService) applicationContext
.getBean("optionService");
try {
PostType postType = postTypeService.findHomePostType();
if (postType == null) {
postType = new PostType();
postType.setName("首页");
postType.setIsHome(1);
// 设置排序号
postType.setOrderId(new Date().getTime());
// 保存
postTypeService.savePostType(postType);
}
} catch (Exception e) {
e.printStackTrace();
}