Ideally, you would be able to specify an external "binding" for the env-entry. I know that's possible to do with WebSphere Application Server (via EnvEntry.Value properties), but I don't know if it's possible with Glassfish.
As a workaround, you could declare the env-entry for injection, and then check in PostConstruct whether any value was injected by the container (i.e., don't specify env-entry-value until you're deploying into the server). If you're using JNDI only, you can do the same thing with try/catch(NameNotFoundException).
@Resource(name="host")
private String host;
@PostConstruct
public void postConstruct() {
if (host == null) {
// Not configured at deployment time.
host = System.getProperty("test.host");
}
}