diff --git a/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java b/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java index 77a0511e4e..650ed23cee 100644 --- a/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java +++ b/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java @@ -406,7 +406,9 @@ public class SpringApplication { try { Class instanceClass = ClassUtils.forName(name, classLoader); Assert.isAssignable(type, instanceClass); - Constructor constructor = instanceClass.getConstructor(parameterTypes); + Constructor constructor = instanceClass + .getDeclaredConstructor(parameterTypes); + constructor.setAccessible(true); T instance = (T) constructor.newInstance(args); instances.add(instance); }