@ApplicationScoped
public class MyBean {
@Inject
private OtherBean otherBean;
@PostConstruct
public void init() {
}
public void doSomething() {
}
@PreDestroy
public void cleanup() {
}
}
@ApplicationScoped
public class OtherBean {
// ...
}
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_2.xsd"
bean-discovery-mode="all">
</beans>