Skip to content

Resolving ${} system properties in @PropertySource annotation does not work anymore [SPR-9380] #14016

@spring-projects-issues

Description

@spring-projects-issues

Marcel Overdijk opened SPR-9380 and commented

I have the blow AppConfig class in my project:

@Configuration
@ComponentScan(basePackages = { "my.project" })
@PropertySource({ "classpath:/META-INF/config.properties", "classpath:/META-INF/config-${my.runtime.environment}.properties" })
public class AppConfig {

	private static Log LOG = LogFactory.getLog(AppConfig.class);

	@Bean
	public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
		return new PropertySourcesPlaceholderConfigurer();
	}

Resolving the ${my.runtime.environment} in the @PropertySource does not work anymore in Spring 3.1.1 while I was just upgrading from 3.1.0.
The same code works fine in 3.1.0 but gives this error in 3.1.1:

Failed to load bean class: mt.project.config.AppConfig; nested exception is java.io.FileNotFoundException: class path resource [META-INF/config-${my.runtime.environment}.properties] cannot be opened because it does not exist

The config file exists and the system property is set (I logged that as well), and just to mention it again. In 3.1.0 this works fine.


Affects: 3.1.1

Issue Links:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions