Found that using @PostConstruct doesn't have transactional ability. Looking around I found this link:
http://forum.springsource.org/showthread.php?t=81832
So by implementing the app listener you can have it bootstrap the configuration once the context has finished loading.
@Repository
public class MyDAOImpl implements ApplicationListener, MyDAO {
@Transactional(propagation=Propagation.REQUIRED)
public void onApplicationEvent(ApplicationEvent event) {
if (event instanceof ContextRefreshedEvent) {
postCreate();
}
}
public void postCreate() {
//Code
}
}
Saturday, 9 January 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment