Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
spring-projects-issues opened this issue Apr 17, 2011 · 3 comments
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: duplicate A duplicate of another issue

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Apr 17, 2011

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:

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented May 10, 2011

Chris Beams commented

Thanks for the report Stepan. Please see the resolution comment on #12917 and try out the new support in the next Spring 3.1 nightly snapshot.

@spring-projects-issues
Copy link
Collaborator Author

Stepan Koltsov commented

Chris, now I should declare PropertyPlaceholderConfigurer as a static @Bean method, and regular beans as usual, right?

@spring-projects-issues
Copy link
Collaborator Author

Chris Beams commented

Correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

1 participant