From b45bb6d082b3a18b47eb14ec81350a6d83122566 Mon Sep 17 00:00:00 2001 From: izeye Date: Mon, 6 Apr 2015 21:49:13 +0900 Subject: [PATCH] Make all of GsonHttpMessageConvertersConfiguration conditional on Gson Previously GsonHttpMessageConvertersConfiguration was unconditional with its nested configuration class being @ConditionalOnClass(Gson.class). This led to the unnecessary registration of the GsonHttpMessageConvertersConfiguration bean when Gson isn't on the classpath. This commit moves the condition up onto the outer class so that no Gson-related beans are created when Gson is not on the classpath. Closes gh-2778 --- .../web/GsonHttpMessageConvertersConfiguration.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/GsonHttpMessageConvertersConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/GsonHttpMessageConvertersConfiguration.java index b857e6df44..60f918c648 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/GsonHttpMessageConvertersConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/GsonHttpMessageConvertersConfiguration.java @@ -36,10 +36,10 @@ import com.google.gson.Gson; * @since 1.2.2 */ @Configuration +@ConditionalOnClass(Gson.class) class GsonHttpMessageConvertersConfiguration { @Configuration - @ConditionalOnClass(Gson.class) @ConditionalOnBean(Gson.class) @Conditional(PreferGsonOrMissingJacksonCondition.class) protected static class GsonHttpMessageConverterConfiguration {