Allow package private spring.factories classes

Update SpringApplication to allow classes loaded from spring.factories
to be package private.

Fixes gh-5043
pull/5060/head
Phillip Webb 9 years ago
parent 26dfbeb8f4
commit 50e78b9c99

@ -406,7 +406,9 @@ public class SpringApplication {
try { try {
Class<?> instanceClass = ClassUtils.forName(name, classLoader); Class<?> instanceClass = ClassUtils.forName(name, classLoader);
Assert.isAssignable(type, instanceClass); Assert.isAssignable(type, instanceClass);
Constructor<?> constructor = instanceClass.getConstructor(parameterTypes); Constructor<?> constructor = instanceClass
.getDeclaredConstructor(parameterTypes);
constructor.setAccessible(true);
T instance = (T) constructor.newInstance(args); T instance = (T) constructor.newInstance(args);
instances.add(instance); instances.add(instance);
} }

Loading…
Cancel
Save