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
This commit is contained in:
izeye 2015-04-06 21:49:13 +09:00 committed by Andy Wilkinson
parent 5547f91bfb
commit b45bb6d082

View File

@ -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 {