spring-framework/spring-test
Sam Brannen 9244090ba0 Support DI of individual constructor args in @Nested tests
Prior to this commit it was impossible to have an individual
constructor argument in a @Nested (i.e., inner) test class injected via
@Autowired, @Qualifier, or @Value.

This is due to a bug in javac on JDK versions prior to 9, whereby
annotation lookups performed directly via the
java.lang.reflect.Parameter API fail for inner class constructors.

Specifically, the parameter annotations array in the compiled byte code
for the user's test class excludes an entry for the implicit enclosing
instance parameter for an inner class constructor.

This commit introduces a workaround in ParameterAutowireUtils for this
off-by-one error by transparently looking up annotations on the
preceding Parameter object (i.e., index - 1). In addition, this commit
relies on the change recently introduced in MethodParameter in order to
compensate for the same JDK bug (see SPR-16652).

Issue: SPR-16653
2018-03-29 17:47:45 +02:00
..
src Support DI of individual constructor args in @Nested tests 2018-03-29 17:47:45 +02:00
.springBeans Support classes AND locations in @ContextConfiguration 2014-04-01 19:45:56 +02:00
spring-test.gradle Upgrade to Jackson 2.9.5 and Hibernate Validator 6.0.9 2018-03-27 17:33:34 +02:00