Issue Details (XML | Word | Printable)

Key: SJC-91
Type: New Feature New Feature
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Chris Beams
Reporter: Chris Beams
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Spring JavaConfig

Support checking @Required properties

Created: 28/Mar/08 01:48 PM   Updated: 23/Dec/08 01:18 PM   Resolved: 30/Mar/08 02:41 PM
Component/s: Compatibility
Affects Version/s: None
Fix Version/s: 1.0.0.M4

Time Tracking:
Original Estimate: 1d
Original Estimate - 1d
Remaining Estimate: 1d
Remaining Estimate - 1d
Time Spent: Not Specified
Time Spent - Not Specified

Issue Links:
Duplicate
 
Supersede
 


 Description  « Hide
Per SJC-17, Spring's RequiredAnnotationBeanPostProcessor cannot work with JavaConfig due to the fact that JavaConfig does not (and will not ever) set a BeanDefinition's PropertyValues.

This calls for an implementation that employs a different strategy for checking that @Required properties have been set.

After exploring a number of options, this will be done using AspectJ.

The net effect will be identical to that of Spring's original RequiredAnnotationBeanPostProcessor: a BeanInitializationException will be thrown if @Required properties are not set.

Chris Beams added a comment - 30/Mar/08 02:41 PM
cbeams@kaizen:~/Work/springsource/spring-javaconfig/trunk>$ svn ci -m"Merging branches/SJC-91 back into trunk to resolve issue SJC-91. @Required methods can now be checked by JavaConfig, with a little help from AspectJ"
Sending trunk/.classpath
Sending trunk/.project
Sending trunk/.springBeans
Sending trunk/pom.xml
Sending trunk/src/main/java/org/springframework/config/java/annotation/Configuration.java
Adding trunk/src/main/java/org/springframework/config/java/aspects
Adding trunk/src/main/java/org/springframework/config/java/aspects/RequiredMethodInvocationRegistry.java
Adding trunk/src/main/java/org/springframework/config/java/aspects/RequiredMethodInvocationTracker.java
Sending trunk/src/main/java/org/springframework/config/java/context/JavaConfigApplicationContext.java
Sending trunk/src/main/java/org/springframework/config/java/process/ConfigurationProcessor.java
Adding trunk/src/main/java/org/springframework/config/java/process/RequiredAnnotationBeanPostProcessor.java
Adding trunk/src/main/resources
Adding trunk/src/main/resources/META-INF
Adding trunk/src/main/resources/META-INF/aop.xml
Adding trunk/src/test/java/issues/Sjc91Tests.java
Sending trunk/src/test/java/org/springframework/config/java/AspectJConfigurationProcessorTests.java
Sending trunk/src/test/java/org/springframework/config/java/LifecycleTests.java
Sending trunk/src/test/java/org/springframework/config/java/context/JavaConfigApplicationContextConstructionTests.java
Sending trunk/src/test/java/org/springframework/config/java/context/JavaConfigApplicationContextTests.java
Sending trunk/src/test/java/org/springframework/config/java/context/JavaConfigWebApplicationContextTests.java
Adding trunk/src/test/java/org/springframework/config/java/test/Assert.java
Adding trunk/src/test/resources/issues/Sjc91Tests.xml
Transmitting file data ............
Committed revision 11499.

Chris Beams added a comment - 30/Mar/08 02:42 PM
Please note that this new feature does require AspectJ bytecode weaving. Users will need to enable either build-time or load-time weaving (an aop.xml is included in META-INF for the latter case). Samples and docs to follow before M4 release.