I’m using Spring 3.2.11.RELEASE. I have a class (annotated with @Service
), in which I have a method
package org.mainco.subco.myproject.service;
…
@PostConstruct
public void initCaches()
{
LOG.info("initiating caches.");
…
} // initCaches
However, this method is never getting called, despite the fact the service class is included in a <context:component-scan />
. I have this in my application context file …
<context:component-scan base-package="org.mainco.subco" />
How do I get a method to be executed when my bean is created/initialized? I don’t care if its @PostConstruct
, if there’s another way or annotation i need. that. The key thing is that the method have access to autowired Spring beans.