Announcement Announcement Module
Collapse

JavaConfig forum decommissioned in favor of Core Container

As described at

http://static.springsource.org/sprin...fig/README.TXT

key features of the Spring JavaConfig project have been migrated into the core Spring Framework as of version 3.0.

Please see the Spring 3.0 documentation on @Configuration and @Bean support:

http://static.springsource.org/sprin...tml#beans-java

For any questions related to @Configuration classes and @Bean methods in Spring 3.0, please post in the dedicated 'Core Container' forum at

http://forum.springsource.org/forumdisplay.php?f=26
See more
See less
RequiredAnnotationBeanPostProcessor always runs contrary to documentation Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • RequiredAnnotationBeanPostProcessor always runs contrary to documentation

    The JavaDoc for @AnnotationDrivenConfig says

    ...
    Note: Unlike its <context:annotation-config/> XML counterpart, this annotation does not trigger the detection and handling of @Required methods. Due to fundamental differences between how JavaConfig and XML work, this must be enabled via AspectJ. See RequiredMethodInvocationTracker for more details. ...
    However I get the following exception when using this annotation (I need it for @Autowired support)

    Code:
     org.springframework.beans.factory.BeanInitializationException: Property 'sessionFactory' is required for bean 'versionInfoProvider'
    	at org.springframework.beans.factory.annotation.RequiredAnnotationBeanPostProcessor.postProcessPropertyValues(RequiredAnnotationBeanPostProcessor.java:121)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:998)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
    	... 13 more
    I'm trying to migrate from XML configuration to Java configuration and I don't want to have to remove the @Required annotation from existing classes.

    I do not need the @Required checking for Java configuration.
Working...
X