I use resource injection in my application scope managed bean with glassfish 4, but glassfish failed to work and using the default derby database instead. there is my code:
@Named(value = "dbManager")
@ApplicationScoped
public class DbManager {
@Resource(name = "jdbc/mydb")
private DataSource ds;
// but lookup method works
ctx = new InitialContext();
ds = (DataSource) ctx.lookup("jdbc/mydb");
I can't find the reason for this.