Spring Framework StandardEnvironment - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework StandardEnvironment class.

This code example shows how to use the following methods:
		} 
	} 
 
	@Test(expected=IllegalArgumentException.class)
	public void testStrictSystemPropertyReplacement() { 
		PropertyEditor editor = new ResourceArrayPropertyEditor(
				new PathMatchingResourcePatternResolver(), new StandardEnvironment(),
				false); 
		System.setProperty("test.prop", "foo");
		try { 
			editor.setAsText("${test.prop}-${bar}");
			Resource[] resources = (Resource[]) editor.getValue();
			assertEquals("foo-${bar}", resources[0].getFilename());
		} 
		finally { 
			System.getProperties().remove("test.prop");
		} 
	} 
 
} 
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getPropertySources
    } 
 
    @Test
    public void testNullProperties() throws Exception {
        EnvironmentPropertiesFactoryBean factory = new EnvironmentPropertiesFactoryBean();
        StandardEnvironment environment = new StandardEnvironment();
        environment.getPropertySources().addFirst(new MapPropertySource("foo", Collections.singletonMap("foo", null)));
        factory.setEnvironment(environment);
        Properties properties = factory.getObject();
        assertEquals("", properties.get("foo"));
    } 
 
    private Properties getProperties(String input) {
        Properties properties = StringUtils.splitArrayElementsIntoProperties(
                        StringUtils.commaDelimitedListToStringArray(input), "=");
        return properties;
    } 
 
} 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
		} 
	} 
 
	@Test(expected=IllegalArgumentException.class)
	public void testStrictSystemPropertyReplacement() { 
		PropertyEditor editor = new ResourceEditor(new DefaultResourceLoader(), new StandardEnvironment(), false);
		System.setProperty("test.prop", "foo");
		try { 
			editor.setAsText("${test.prop}-${bar}");
			Resource resolved = (Resource) editor.getValue();
			assertEquals("foo-${bar}", resolved.getFilename());
		} 
		finally { 
			System.getProperties().remove("test.prop");
		} 
	} 
 
} 
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:addActiveProfile
 
	@Test @Ignore
	public void testAdminFailsWithMismatchedQueue() throws Exception {
		ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext();
		context.setConfigLocation("org/springframework/amqp/rabbit/config/MismatchedQueueDeclarationTests-context.xml");
		StandardEnvironment env = new StandardEnvironment();
		env.addActiveProfile("basicAdmin");
		env.addActiveProfile("basic");
		context.setEnvironment(env);
		context.refresh();
		context.getBean(CachingConnectionFactory.class).createConnection();
		context.destroy();
		Channel channel = this.connectionFactory.createConnection().createChannel(false);
		channel.queueDeclarePassive("mismatch.bar");
		this.admin.deleteQueue("mismatch.bar");
		assertNotNull(this.admin.getQueueProperties("mismatch.foo"));
		assertNull(this.admin.getQueueProperties("mismatch.bar"));
 
		env = new StandardEnvironment();
		env.addActiveProfile("basicAdmin");
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
	@Override 
	protected ConfigurationClassParser newParser() { 
		return new ConfigurationClassParser( 
				new CachingMetadataReaderFactory(),
				new FailFastProblemReporter(),
				new StandardEnvironment(),
				new DefaultResourceLoader(),
				new AnnotationBeanNameGenerator(),
				new DefaultListableBeanFactory());
	} 
 
	@Override 
	protected String loadAsConfigurationSource(Class<?> clazz) throws Exception {
		return clazz.getName();
	} 
 
} 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
 * @author Juergen Hoeller 
 * @since 3.1 
 * @see StandardEnvironment 
 * @see StandardServletEnvironment 
 */ 
public class StandardPortletEnvironment extends StandardEnvironment {
 
	/** Portlet context init parameters property source name: {@value} */ 
	public static final String PORTLET_CONTEXT_PROPERTY_SOURCE_NAME = "portletContextInitParams";
 
	/** Portlet config init parameters property source name: {@value} */ 
	public static final String PORTLET_CONFIG_PROPERTY_SOURCE_NAME = "portletConfigInitParams";
 
 
	/** 
	 * Customize the set of property sources with those contributed by superclasses as 
	 * well as those appropriate for standard portlet-based environments: 
	 * <ul> 
	 * <li>{@value #PORTLET_CONFIG_PROPERTY_SOURCE_NAME} 
	 * <li>{@value #PORTLET_CONTEXT_PROPERTY_SOURCE_NAME} 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
	 * @deprecated as of Spring 3.1 in favor of 
	 * {@link #ResourceEditorRegistrar(ResourceLoader, PropertyResolver)} 
	 */ 
	@Deprecated 
	public ResourceEditorRegistrar(ResourceLoader resourceLoader) {
		this(resourceLoader, new StandardEnvironment());
	} 
 
	/** 
	 * Create a new ResourceEditorRegistrar for the given {@link ResourceLoader} 
	 * and {@link PropertyResolver}. 
	 * @param resourceLoader the ResourceLoader (or ResourcePatternResolver) 
	 * to create editors for (usually an ApplicationContext) 
	 * @param propertyResolver the PropertyResolver (usually an Environment) 
	 * @see org.springframework.core.env.Environment 
	 * @see org.springframework.core.io.support.ResourcePatternResolver 
	 * @see org.springframework.context.ApplicationContext 
	 */ 
	public ResourceEditorRegistrar(ResourceLoader resourceLoader, PropertyResolver propertyResolver) {
		this.resourceLoader = resourceLoader;
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
	private static Environment getOrCreateEnvironment(BeanDefinitionRegistry registry) {
		Assert.notNull(registry, "BeanDefinitionRegistry must not be null");
		if (registry instanceof EnvironmentCapable) {
			return ((EnvironmentCapable) registry).getEnvironment();
		} 
		return new StandardEnvironment();
	} 
 
} 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
	 * Return a new {@link StandardEnvironment}. 
	 * <p>Subclasses may override this method in order to supply 
	 * a custom {@link ConfigurableEnvironment} implementation. 
	 */ 
	protected ConfigurableEnvironment createEnvironment() {
		return new StandardEnvironment();
	} 
 
	/** 
	 * This implementation loads a Spring ApplicationContext through the 
	 * {@link #createApplicationContext} template method. 
	 */ 
	@Override 
	public void start(BootstrapContext bootstrapContext) throws ResourceAdapterInternalException {
		if (logger.isInfoEnabled()) {
			logger.info("Starting SpringContextResourceAdapter with BootstrapContext: " + bootstrapContext);
		} 
		this.applicationContext = createApplicationContext(bootstrapContext);
	} 
 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
 * The ToolingAwareEnvironment is used to accept all kind of profiles 
 * for creating the internal beans model for the tooling. 
 * @author Martin Lippert 
 * @since 2.9.0 
 */ 
public class ToolingAwareEnvironment extends StandardEnvironment { 
	 
	@Override 
	public boolean acceptsProfiles(String... profiles) { 
		return true; 
	} 
 
} 
5
CodeRank
Experience pair programming with AI  Get Codota for Java