I am using resource injection in my bean-driven application area using glass fish 4, but glass fish does not work and instead uses the default derby database. there is my code:
@Named(value = "dbManager") @ApplicationScoped public class DbManager { @Resource(name = "jdbc/mydb") private DataSource ds;
// but the search method works
ctx = new InitialContext(); ds = (DataSource) ctx.lookup("jdbc/mydb");
I can not find the reason for this.
source share