I have such dependencies:
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.2.10</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.2.10</version>
</dependency>
And managed bean:
@ManagedBean(eager = true)
@ApplicationScoped
public class AppBean implements Serializable{
private List<SelectItem> someEntitySI = null;
@PostConstruct
public void init(){
try {
someEntitySI = new ArrayList<SelectItem>();
List<SomeEntity> types = Factory.getInstance().getSomeEntityDAO().getAllSomeEntities();
for(SomeEntity type : types) {
someEntitySI .add(new SelectItem(someEntity.getId(), someEntity.getName()));
}
} catch (SQLException e) {
e.printStackTrace();
}
}
When I deployed this on Tomcat @PostConstruct called, but when I deployed the same code on Glassfish(v4.1) the @PostConstruct don't work. Why so?