Is there a way to start a CDI bean next to the application
I have the following bean:
@ApplicationScoped
@Named
public class MyBean implements Serializable {
@Inject
private Helper helper;
@PostConstruct
public void init() {
helper.doThings();
}
}
I would like it to be started together with the application, when it is deployed.
I'm using weld-servlet as a cdi implementation and tomcat7:
<dependency>
<groupId>org.jboss.weld.servlet</groupId>
<artifactId>weld-servlet</artifactId>
<version>${weld-servlet.version}</version>
<scope>compile</scope>
</dependency>