From bcacf7efbf0bf258ff808e74e9ecf8316e489af9 Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Thu, 23 Aug 2018 14:16:15 +0100 Subject: [PATCH] Use null check on groovyReader instead of class loading To detect Groovy we can use the null value of the reader as a test equivalently outside the constructor. --- .../java/org/springframework/boot/BeanDefinitionLoader.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/BeanDefinitionLoader.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/BeanDefinitionLoader.java index ce38cf8e5764..7d60f1906818 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/BeanDefinitionLoader.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/BeanDefinitionLoader.java @@ -147,7 +147,7 @@ private int load(Object source) { } private int load(Class source) { - if (isGroovyPresent() + if (this.groovyReader != null && GroovyBeanDefinitionSource.class.isAssignableFrom(source)) { // Any GroovyLoaders added in beans{} DSL can contribute beans here GroovyBeanDefinitionSource loader = BeanUtils.instantiateClass(source,