实现InitializingBean, ServletContextAware

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
@Service
public class ConstanstMap implements InitializingBean, ServletContextAware {

public final static Map<String, String> initConfig = new HashMap<>();


@Resource
private ContentVoMapper contentDao;

@Override
public void afterPropertiesSet() throws Exception {

}

@Override
public void setServletContext(ServletContext servletContext) {
ContentVoExample contentVoExample = new ContentVoExample();
contentVoExample.createCriteria().andTypeEqualTo(Types.PAGE.getType());
List<ContentVo> contentVos = contentDao.selectByExampleWithBLOBs(contentVoExample);
for (ContentVo contentVo : contentVos) {
initConfig.put(contentVo.getSlug(),contentVo.getTitle());

}
}
}


spring     

本博客所有文章除特别声明外,均采用 CC BY-SA 3.0协议 。转载请注明出处!