/** * Create and return a new {@link StandardServletEnvironment}. */ @Override protected ConfigurableEnvironment createEnvironment() { return new StandardServletEnvironment(); }
/** * Create and return a new {@link StandardServletEnvironment}. * <p>Subclasses may override this in order to configure the environment or * specialize the environment type returned. */ protected ConfigurableEnvironment createEnvironment() { return new StandardServletEnvironment(); }
/** * Create and return a new {@link StandardServletEnvironment}. */ @Override protected ConfigurableEnvironment createEnvironment() { return new StandardServletEnvironment(); }
/** * Create and return a new {@link StandardServletEnvironment}. * <p>Subclasses may override this in order to configure the environment or * specialize the environment type returned. * @since 4.3.9 */ protected Environment createEnvironment() { return new StandardServletEnvironment(); }
/** * Create and return a new {@link StandardServletEnvironment}. Subclasses may override * in order to configure the environment or specialize the environment type returned. */ @Override protected ConfigurableEnvironment createEnvironment() { return new StandardServletEnvironment(); }
/** * Create and return a new {@link StandardServletEnvironment}. Subclasses may override * in order to configure the environment or specialize the environment type returned. */ @Override protected ConfigurableEnvironment createEnvironment() { return new StandardServletEnvironment(); }
/** * Create and return a new {@link StandardServletEnvironment}. * <p>Subclasses may override this in order to configure the environment or * specialize the environment type returned. * @since 4.3.9 */ protected Environment createEnvironment() { return new StandardServletEnvironment(); }
/** * Create and return a new {@link StandardServletEnvironment}. */ @Override protected ConfigurableEnvironment createEnvironment() { return new StandardServletEnvironment(); }
/** * Create and return a new {@link StandardServletEnvironment}. */ @Override protected ConfigurableEnvironment createEnvironment() { return new StandardServletEnvironment(); }
/** * Create and return a new {@link StandardServletEnvironment}. * <p>Subclasses may override this in order to configure the environment or * specialize the environment type returned. */ protected ConfigurableEnvironment createEnvironment() { return new StandardServletEnvironment(); }
private ConfigurableEnvironment getOrCreateEnvironment() { if (this.environment != null) { return this.environment; } switch (this.webApplicationType) { case SERVLET: return new StandardServletEnvironment(); case REACTIVE: return new StandardReactiveWebEnvironment(); default: return new StandardEnvironment(); } }
Environment env = this.environment; if (env == null) { env = new StandardServletEnvironment();
Environment env = this.environment; if (env == null) { env = new StandardServletEnvironment();
@Test public void propertySourceOrder() throws Exception { SimpleNamingContextBuilder.emptyActivatedContextBuilder(); ConfigurableEnvironment env = new StandardServletEnvironment(); MutablePropertySources sources = env.getPropertySources(); assertThat(sources.precedenceOf(PropertySource.named( StandardServletEnvironment.SERVLET_CONFIG_PROPERTY_SOURCE_NAME)), equalTo(0)); assertThat(sources.precedenceOf(PropertySource.named( StandardServletEnvironment.SERVLET_CONTEXT_PROPERTY_SOURCE_NAME)), equalTo(1)); assertThat(sources.precedenceOf(PropertySource.named( StandardServletEnvironment.JNDI_PROPERTY_SOURCE_NAME)), equalTo(2)); assertThat(sources.precedenceOf(PropertySource.named( StandardEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME)), equalTo(3)); assertThat(sources.precedenceOf(PropertySource.named( StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME)), equalTo(4)); assertThat(sources.size(), is(5)); }
@Test public void environmentOperations() { DispatcherServlet servlet = new DispatcherServlet(); ConfigurableEnvironment defaultEnv = servlet.getEnvironment(); assertThat(defaultEnv, notNullValue()); ConfigurableEnvironment env1 = new StandardServletEnvironment(); servlet.setEnvironment(env1); // should succeed assertThat(servlet.getEnvironment(), sameInstance(env1)); try { servlet.setEnvironment(new DummyEnvironment()); fail("expected IllegalArgumentException for non-configurable Environment"); } catch (IllegalArgumentException ex) { } class CustomServletEnvironment extends StandardServletEnvironment { } @SuppressWarnings("serial") DispatcherServlet custom = new DispatcherServlet() { @Override protected ConfigurableWebEnvironment createEnvironment() { return new CustomServletEnvironment(); } }; assertThat(custom.getEnvironment(), instanceOf(CustomServletEnvironment.class)); }
/** * Create and return a new {@link StandardServletEnvironment}. * <p>Subclasses may override this in order to configure the environment or * specialize the environment type returned. */ protected ConfigurableEnvironment createEnvironment() { return new StandardServletEnvironment(); }
/** * Create and return a new {@link StandardServletEnvironment}. Subclasses may override * in order to configure the environment or specialize the environment type returned. */ @Override protected ConfigurableEnvironment createEnvironment() { return new StandardServletEnvironment(); }
/** * Create and return a new {@link StandardServletEnvironment}. * <p>Subclasses may override this in order to configure the environment or * specialize the environment type returned. * @since 4.3.9 */ protected Environment createEnvironment() { return new StandardServletEnvironment(); }
/** * Create and return a new {@link StandardServletEnvironment}. * <p>Subclasses may override this in order to configure the environment or * specialize the environment type returned. * @since 4.3.9 */ protected Environment createEnvironment() { return new StandardServletEnvironment(); }
@Override protected ConfigurableEnvironment createEnvironment() { GrailsApplication grailsApplication = getGrailsApplication(); return grailsApplication == null ? new StandardServletEnvironment() : new GrailsEnvironment(grailsApplication); }