-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Closed
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancementA general enhancement
Milestone
Description
André Berenguel opened SPR-9473 and commented
The following code does not resolve the property ${database.url}
correctly.
@Configuration
@PropertySource("classpath:/myapp.properties")
public class ApplicationConfig {
@Autowired
private Environment env;
...
@Bean(destroyMethod = "close")
public DataSource dataSource() {
...
dataSource.setJdbcUrl(env.getProperty("database.url"));
...
}
When the file myapp.properties
is like
database.host=localhost
database.port=3306
database.base=mybase
database.url=jdbc:mysql://${database.host}:${database.port}/${database.base}?autoReconnect=true
The property is being resolved as it is declared: jdbc:mysql://${database.host}:${database.port}/${database.base}?autoReconnect=true
I expected it was resolved as jdbc:mysql://localhost:3306/mybase?autoReconnect=true
Affects: 3.1 GA
Issue Links:
- Allow PropertyResolver implementations to ignore unresolvable ${placeholders} [SPR-9569] #14203 Allow PropertyResolver implementations to ignore unresolvable ${placeholders} ("is depended on by")
Metadata
Metadata
Assignees
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancementA general enhancement