Sean Clark wrote:Hey Mark,
Thanks for your reply. I had already tried with the @PostConstruct annotation, but for some reason I was getting transaction manager exceptions when I was trying to run DAO code (perhaps the transaction manager hadn't started up). Anyway I think we resolved the issue, we created a class that implements the ApplicationListener interface and looked for a ContextRefreshed Event and this seems to work.
Thanks for your reply though.
Sean
Yes that does work. The only issue with it is now you have a class that it coupled with Spring. Meaning that class won't work outside of Spring, you will always have to have the Spring jars in your classpath at compile and runtime.
Whereas with @PostContruct or init-method, your code can stay POJO.
What were the transaction exceptions you got. Spring will not call your @PostConstruct method till all beans are instantiated, dependencies injected and properties set, so it must have been something else.
Thanks
Mark