然后配置一个bean:
<!--注意:lazy-init="false" init-method="init" -->
<bean id="cacheLoder" lazy-init="false" class="CacheLoder" init-method="init" />
写一个加载类:
public class CacheLoder{
@Resource
private MemberUserService memberUserService;
public void init(){
System.out.println(memberUserService.getAll());
//在这里加载缓存..
}
}
或者:
<!-- 扫描注解Bean -->
<context:annotation-config></context:annotation-config>
<context:component-scan base-package="**.action,**.service.impl,**.dao.impl **.listener **.timer"></context:component-scan>
package com.zy.netschool.advisor.service.impl;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import org.springframework.stereotype.Component;
import com.xx.member.service.MemberUserService;
@Component
public class MetadataService {
@Resource
private MemberUserService memberUserService;
@PostConstruct
public void loadMetadata() {
System.out.println("aaaaaaaaaaaaaaaaaa------------------"+memberUserService.getAll());
}
}