@Override
    public InitialContextFactory createInitialContextFactory(Hashtable<?, ?> environment) throws NamingException {
        return new InitialContextFactory() {
            @Override
            public Context getInitialContext(Hashtable<?, ?> environment) throws NamingException {
                for (Map.Entry<?,?> propEntries : environment.entrySet())  {
                    context.addToEnvironment((String)propEntries.getKey(), propEntries.getValue());
                }
                return context;
            }
        };
    }