Skip to content

@PostConstruct and PropertyPlaceholderConfigurer do not work together in AnnotationConfigApplicationContext [SPR-8257] #12905

Closed
@spring-projects-issues

Description

@spring-projects-issues

Stepan Koltsov opened SPR-8257 and commented

@Configuration
public class TmpConfig {

    @PostConstruct
    public void init() {
        System.out.println("TmpConfig.init");
    }

    @Bean
    public PropertyPlaceholderConfigurer propertyPlaceholderConfigurer() {
        return new PropertyPlaceholderConfigurer();
    }

}


new AnnotationConfigApplicationContext(TmpConfig.class);

nothing is printed. However, if propertyPlaceholderConfigurer bean removed:

@Configuration
public class TmpConfig {

    @PostConstruct
    public void init() {
        System.out.println("TmpConfig.init");
    }

}


new AnnotationConfigApplicationContext(TmpConfig.class);

"TmpConfig.init" is printed as expected.


Affects: 3.1 M1

Issue Links:

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: coreIssues in core modules (aop, beans, core, context, expression)status: duplicateA duplicate of another issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions