Java Code Examples for org.springframework.context.support.PropertySourcesPlaceholderConfigurer#setIgnoreUnresolvablePlaceholders()
The following examples show how to use
org.springframework.context.support.PropertySourcesPlaceholderConfigurer#setIgnoreUnresolvablePlaceholders() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SecurityDomainRouterFactory.java From graviteeio-access-management with Apache License 2.0 | 6 votes |
AbstractApplicationContext createApplicationContext(Domain domain) { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); context.setParent(gatewayApplicationContext); context.setClassLoader(new ReactorHandlerClassLoader(gatewayApplicationContext.getClassLoader())); context.setEnvironment((ConfigurableEnvironment) gatewayApplicationContext.getEnvironment()); PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer(); configurer.setIgnoreUnresolvablePlaceholders(true); configurer.setEnvironment(gatewayApplicationContext.getEnvironment()); context.addBeanFactoryPostProcessor(configurer); context.getBeanFactory().registerSingleton("domain", domain); context.register(HandlerConfiguration.class); context.setId("context-domain-" + domain.getId()); context.refresh(); return context; }
Example 2
Source File: ApplicationAutoConfiguration.java From MaxKey with Apache License 2.0 | 6 votes |
/** * propertySourcesPlaceholderConfigurer . * @return propertySourcesPlaceholderConfigurer * @throws IOException null */ @Bean (name = "propertySourcesPlaceholderConfigurer") public PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() throws IOException { ClassPathResource classPathResource1 = new ClassPathResource(ConstantsProperties.classPathResource( ConstantsProperties.applicationPropertySource)); ClassPathResource classPathResource2 = new ClassPathResource(ConstantsProperties.classPathResource( ConstantsProperties.maxKeyPropertySource)); PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer(); configurer.setLocations( classPathResource1, classPathResource2 ); configurer.setIgnoreUnresolvablePlaceholders(true); _logger.debug("PropertySourcesPlaceholderConfigurer init"); return configurer; }
Example 3
Source File: OverrideProperties.java From sinavi-jfw with Apache License 2.0 | 6 votes |
@Bean public static PropertySourcesPlaceholderConfigurer placeHolderConfigurer() { PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer(); configurer.setIgnoreResourceNotFound(true); configurer.setIgnoreUnresolvablePlaceholders(true); MutablePropertySources propertySources = new MutablePropertySources(); MockPropertySource source = new MockPropertySource() .withProperty("rabbitmq.host", "192.168.10.10") .withProperty("rabbitmq.port", "5673") .withProperty("rabbitmq.username", "jfw") .withProperty("rabbitmq.password", "jfw") .withProperty("rabbitmq.channel-cache-size", 100); propertySources.addLast(source); configurer.setPropertySources(propertySources); return configurer; }
Example 4
Source File: ApiContextHandlerFactory.java From gravitee-gateway with Apache License 2.0 | 6 votes |
AbstractApplicationContext createApplicationContext(Api api) { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); context.setParent(gatewayApplicationContext); context.setClassLoader(new ReactorHandlerClassLoader(gatewayApplicationContext.getClassLoader())); context.setEnvironment((ConfigurableEnvironment) gatewayApplicationContext.getEnvironment()); PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer(); configurer.setIgnoreUnresolvablePlaceholders(true); configurer.setEnvironment(gatewayApplicationContext.getEnvironment()); context.addBeanFactoryPostProcessor(configurer); context.getBeanFactory().registerSingleton("api", api); context.register(ApiHandlerConfiguration.class); context.setId("context-api-" + api.getId()); context.refresh(); return context; }
Example 5
Source File: PlatformITConfig.java From molgenis with GNU Lesser General Public License v3.0 | 5 votes |
@Bean public static PropertySourcesPlaceholderConfigurer properties() { PropertySourcesPlaceholderConfigurer pspc = new PropertySourcesPlaceholderConfigurer(); Resource[] resources = new Resource[] {new ClassPathResource("/conf/molgenis.properties")}; pspc.setLocations(resources); pspc.setFileEncoding("UTF-8"); pspc.setIgnoreUnresolvablePlaceholders(true); pspc.setIgnoreResourceNotFound(true); pspc.setNullValue("@null"); return pspc; }
Example 6
Source File: NacosBeanUtils.java From nacos-spring-project with Apache License 2.0 | 5 votes |
/** * Register {@link PropertySourcesPlaceholderConfigurer} Bean * * @param registry {@link BeanDefinitionRegistry} * @param beanFactory {@link BeanFactory} */ public static void registerPropertySourcesPlaceholderConfigurer( BeanDefinitionRegistry registry, BeanFactory beanFactory) { registerInfrastructureBeanIfAbsent(registry, PLACEHOLDER_CONFIGURER_BEAN_NAME, PropertySourcesPlaceholderConfigurer.class); /* * If you can't guarantee your old project properties file and config items are * complete , please setIgnoreUnresolvablePlaceholders setIgnoreResourceNotFound * is true 。 if not,you may not be able to start the spring container and your * application */ boolean ignoreResourceNotFound = Boolean .parseBoolean(System.getProperty(IGNORE_RESOURCE_NOT_FOUND)); boolean ignoreUnresolvablePlaceholders = Boolean .parseBoolean(System.getProperty(IGNORE_UNRESOLVABLE_PLACEHOLDERS)); if (ignoreResourceNotFound || ignoreUnresolvablePlaceholders) { PropertySourcesPlaceholderConfigurer configurer = (PropertySourcesPlaceholderConfigurer) beanFactory .getBean(NacosBeanUtils.PLACEHOLDER_CONFIGURER_BEAN_NAME); if (configurer != null) { configurer.setIgnoreResourceNotFound(ignoreResourceNotFound); configurer.setIgnoreUnresolvablePlaceholders( ignoreUnresolvablePlaceholders); } } }
Example 7
Source File: RetryTestConsumerContextConfig.java From sinavi-jfw with Apache License 2.0 | 5 votes |
@Bean public static PropertySourcesPlaceholderConfigurer placeHolderConfigurer() { PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer(); configurer.setIgnoreResourceNotFound(true); configurer.setIgnoreUnresolvablePlaceholders(true); return configurer; }
Example 8
Source File: InvalidProperties.java From sinavi-jfw with Apache License 2.0 | 5 votes |
@Bean public static PropertySourcesPlaceholderConfigurer placeHolderConfigurer() { PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer(); configurer.setIgnoreResourceNotFound(true); configurer.setIgnoreUnresolvablePlaceholders(true); MutablePropertySources propertySources = new MutablePropertySources(); MockPropertySource source = new MockPropertySource() .withProperty("rabbitmq.port", "invalid"); propertySources.addLast(source); configurer.setPropertySources(propertySources); return configurer; }
Example 9
Source File: DefaultProperties.java From sinavi-jfw with Apache License 2.0 | 5 votes |
@Bean public static PropertySourcesPlaceholderConfigurer placeHolderConfigurer() { PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer(); configurer.setIgnoreResourceNotFound(true); configurer.setIgnoreUnresolvablePlaceholders(true); return configurer; }
Example 10
Source File: OverrideProperties.java From sinavi-jfw with Apache License 2.0 | 5 votes |
@Bean public static PropertySourcesPlaceholderConfigurer placeHolderConfigurer() { PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer(); configurer.setIgnoreResourceNotFound(true); configurer.setIgnoreUnresolvablePlaceholders(true); return configurer; }
Example 11
Source File: ProvisioningTestContext.java From syncope with Apache License 2.0 | 5 votes |
@Bean public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() throws IOException { PropertySourcesPlaceholderConfigurer pspc = new PropertySourcesPlaceholderConfigurer(); pspc.setIgnoreResourceNotFound(true); pspc.setIgnoreUnresolvablePlaceholders(true); return pspc; }
Example 12
Source File: IdMLogicTestContext.java From syncope with Apache License 2.0 | 5 votes |
@Bean public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() throws IOException { PropertySourcesPlaceholderConfigurer pspc = new PropertySourcesPlaceholderConfigurer(); pspc.setIgnoreResourceNotFound(true); pspc.setIgnoreUnresolvablePlaceholders(true); return pspc; }
Example 13
Source File: CommitIdApplication.java From tutorials with MIT License | 5 votes |
@Bean public static PropertySourcesPlaceholderConfigurer placeholderConfigurer() { PropertySourcesPlaceholderConfigurer c = new PropertySourcesPlaceholderConfigurer(); c.setLocation(new ClassPathResource("git.properties")); c.setIgnoreResourceNotFound(true); c.setIgnoreUnresolvablePlaceholders(true); return c; }
Example 14
Source File: PropertiesConfiguration.java From Profiles-Blog with MIT License | 5 votes |
protected static PropertySourcesPlaceholderConfigurer createPropertySourcesPlaceholderConfigurer(Resource... resources) { final PropertySourcesPlaceholderConfigurer ppc = new PropertySourcesPlaceholderConfigurer(); ppc.setIgnoreUnresolvablePlaceholders(true); ppc.setIgnoreResourceNotFound(false); ppc.setLocations(resources); return ppc; }
Example 15
Source File: AbstractMolgenisIntegrationTests.java From molgenis with GNU Lesser General Public License v3.0 | 5 votes |
@Bean public static PropertySourcesPlaceholderConfigurer properties() { PropertySourcesPlaceholderConfigurer pspc = new PropertySourcesPlaceholderConfigurer(); Resource[] resources = new Resource[] {new ClassPathResource("/conf/molgenis.properties")}; pspc.setLocations(resources); pspc.setFileEncoding("UTF-8"); pspc.setIgnoreUnresolvablePlaceholders(true); pspc.setIgnoreResourceNotFound(true); pspc.setNullValue("@null"); return pspc; }
Example 16
Source File: PropertySourcesPlaceholderConfig.java From tutorials with MIT License | 5 votes |
@Bean public static PropertySourcesPlaceholderConfigurer properties(){ PropertySourcesPlaceholderConfigurer pspc = new PropertySourcesPlaceholderConfigurer(); Resource[] resources = new ClassPathResource[]{ new ClassPathResource("foo.properties") }; pspc.setLocations(resources); pspc.setIgnoreUnresolvablePlaceholders(true); return pspc; }
Example 17
Source File: ProtocolPluginManagerImpl.java From graviteeio-access-management with Apache License 2.0 | 5 votes |
@Override public ProtocolProvider create(String type, ApplicationContext parentContext) { logger.debug("Looking for an protocol provider for [{}]", type); Protocol protocol = protocols.get(type); if (protocol != null) { try { ProtocolProvider protocolProvider = createInstance(protocol.protocolProvider()); Plugin plugin = protocolPlugins.get(protocol); AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); context.setParent(parentContext); context.setClassLoader(pluginClassLoaderFactory.getOrCreateClassLoader(plugin)); context.setEnvironment((ConfigurableEnvironment) parentContext.getEnvironment()); PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer(); configurer.setIgnoreUnresolvablePlaceholders(true); configurer.setEnvironment(parentContext.getEnvironment()); context.addBeanFactoryPostProcessor(configurer); context.register(protocol.configuration()); context.registerBeanDefinition(plugin.clazz(), BeanDefinitionBuilder.rootBeanDefinition(plugin.clazz()).getBeanDefinition()); context.refresh(); context.getAutowireCapableBeanFactory().autowireBean(protocolProvider); if (protocolProvider instanceof InitializingBean) { ((InitializingBean) protocolProvider).afterPropertiesSet(); } return protocolProvider; } catch (Exception ex) { logger.error("An unexpected error occurs while loading protocol", ex); return null; } } else { logger.error("No protocol provider is registered for type {}", type); throw new IllegalStateException("No protocol provider is registered for type " + type); } }
Example 18
Source File: ServiceConfig.java From tutorials with MIT License | 4 votes |
@Bean public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() { final PropertySourcesPlaceholderConfigurer ppc = new PropertySourcesPlaceholderConfigurer(); ppc.setIgnoreUnresolvablePlaceholders(true); return ppc; }
Example 19
Source File: MSF4JSpringConfiguration.java From msf4j with Apache License 2.0 | 4 votes |
@Bean public static PropertySourcesPlaceholderConfigurer propertyConfigurer() { PropertySourcesPlaceholderConfigurer pspc = new PropertySourcesPlaceholderConfigurer(); pspc.setIgnoreUnresolvablePlaceholders(true); return pspc; }
Example 20
Source File: WebConfig.java From tutorials with MIT License | 4 votes |
@Bean public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() { final PropertySourcesPlaceholderConfigurer ppc = new PropertySourcesPlaceholderConfigurer(); ppc.setIgnoreUnresolvablePlaceholders(true); return ppc; }