commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "DiFrango, Ronald" <>
Subject Re: [configuration] use commons configuration 2 as PropertySource in Spring
Date Mon, 04 Apr 2016 02:09:16 GMT

For Commons 1.x, my team followed this example to create a bridge:

Then, we created an extension of Spring's PropertySourceLoader that instantiates this class,
therefore we can use commons config with @Value.  This was all bridged using Spring Initializer

The other alternative we used was to create a static bean in our config class that looks something

	public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer(ConfigurableEnvironment
env) {
		PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer();
		MutablePropertySources sources = new MutablePropertySources();
		sources.addLast(new ApacheCommonsConfigPropertySource(<your loaded commons config class>));
		return configurer;

We are just now starting to assess Config 2, but I would assume these approaches would still


Ron DiFrango

On 3/31/16, 8:27 AM, "Dennis Kieselhorst" <> wrote:

>great to see that Commons Configuration 2.0 is out.
>There is one question that appeared during the migration in one of my
>projects. With Commons Configuration 1.0 a Spring modules factory bean
>(org.springmodules.commons.configuration.CommonsConfigurationFactoryBean) was
>used to directly use Commons Configuration with Spring's
>PropertyPlaceholderConfigurer. As this is no longer maintained, the
>question is how to do this with Commons Configuration 2.0.
>Of course it should be possible to copy the existing Spring modules
>source code to the project and migrate it to 2.0. Is there some better
>way to do this? I know Spring offers YAML, but it should be still
>Commons Configuration (the existing XML configuration files should not
>be affected).
>To unsubscribe, e-mail:
>For additional commands, e-mail:

The information contained in this e-mail is confidential and/or proprietary to Capital One
and/or its affiliates and may only be used solely in performance of work or services for Capital
One. The information transmitted herewith is intended only for use by the individual or entity
to which it is addressed. If the reader of this message is not the intended recipient, you
are hereby notified that any review, retransmission, dissemination, distribution, copying
or other use of, or taking of any action in reliance upon this information is strictly prohibited.
If you have received this communication in error, please contact the sender and delete the
material from your computer.
View raw message