mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-09-30 14:19:30 +00:00
Create spring-boot-gson module
Closes gh-46112
This commit is contained in:
committed by
Andy Wilkinson
parent
9aff22d98f
commit
c4e6d94f37
@@ -78,6 +78,7 @@ include "spring-boot-project:spring-boot-elasticsearch"
|
||||
include "spring-boot-project:spring-boot-flyway"
|
||||
include "spring-boot-project:spring-boot-freemarker"
|
||||
include "spring-boot-project:spring-boot-groovy-templates"
|
||||
include "spring-boot-project:spring-boot-gson"
|
||||
include "spring-boot-project:spring-boot-hazelcast"
|
||||
include "spring-boot-project:spring-boot-integration"
|
||||
include "spring-boot-project:spring-boot-jackson"
|
||||
|
||||
@@ -84,7 +84,6 @@ dependencies {
|
||||
optional("com.fasterxml.jackson.datatype:jackson-datatype-jsr310")
|
||||
optional("com.fasterxml.jackson.module:jackson-module-jakarta-xmlbind-annotations")
|
||||
optional("com.fasterxml.jackson.module:jackson-module-parameter-names")
|
||||
optional("com.google.code.gson:gson")
|
||||
optional("com.hazelcast:hazelcast-spring")
|
||||
optional("com.h2database:h2")
|
||||
optional("com.nimbusds:oauth2-oidc-sdk")
|
||||
@@ -221,6 +220,7 @@ dependencies {
|
||||
optional("redis.clients:jedis")
|
||||
|
||||
testImplementation(project(":spring-boot-project:spring-boot-freemarker"))
|
||||
testImplementation(project(":spring-boot-project:spring-boot-gson"))
|
||||
testImplementation(project(":spring-boot-project:spring-boot-jetty"))
|
||||
testImplementation(project(":spring-boot-project:spring-boot-test"))
|
||||
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
|
||||
|
||||
+3
-4
@@ -24,7 +24,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication.Type;
|
||||
import org.springframework.boot.autoconfigure.condition.NoneNestedConditions;
|
||||
import org.springframework.boot.autoconfigure.gson.GsonAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration.NotReactiveWebApplicationCondition;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -48,9 +47,9 @@ import org.springframework.http.converter.StringHttpMessageConverter;
|
||||
* @author Eddú Meléndez
|
||||
* @since 2.0.0
|
||||
*/
|
||||
@AutoConfiguration(after = { GsonAutoConfiguration.class },
|
||||
afterName = { "org.springframework.boot.jackson.autoconfigure.JacksonAutoConfiguration",
|
||||
"org.springframework.boot.jsonb.autoconfigure.JsonbAutoConfiguration" })
|
||||
@AutoConfiguration(afterName = { "org.springframework.boot.jackson.autoconfigure.JacksonAutoConfiguration",
|
||||
"org.springframework.boot.jsonb.autoconfigure.JsonbAutoConfiguration",
|
||||
"org.springframework.boot.gson.autoconfigure.GsonAutoConfiguration" })
|
||||
@ConditionalOnClass(HttpMessageConverter.class)
|
||||
@Conditional(NotReactiveWebApplicationCondition.class)
|
||||
@Import({ JacksonHttpMessageConvertersConfiguration.class, GsonHttpMessageConvertersConfiguration.class,
|
||||
|
||||
-1
@@ -39,7 +39,6 @@ org.springframework.boot.autoconfigure.graphql.rsocket.RSocketGraphQlClientAutoC
|
||||
org.springframework.boot.autoconfigure.graphql.security.GraphQlWebFluxSecurityAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.graphql.security.GraphQlWebMvcSecurityAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.graphql.servlet.GraphQlWebMvcAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.gson.GsonAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.h2.H2ConsoleAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.hateoas.HypermediaAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration
|
||||
|
||||
+1
-1
@@ -25,9 +25,9 @@ import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.autoconfigure.gson.GsonAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.http.JacksonHttpMessageConvertersConfiguration.MappingJackson2HttpMessageConverterConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.ServerProperties;
|
||||
import org.springframework.boot.gson.autoconfigure.GsonAutoConfiguration;
|
||||
import org.springframework.boot.jackson.autoconfigure.JacksonAutoConfiguration;
|
||||
import org.springframework.boot.jsonb.autoconfigure.JsonbAutoConfiguration;
|
||||
import org.springframework.boot.test.context.FilteredClassLoader;
|
||||
|
||||
@@ -2004,6 +2004,7 @@ bom {
|
||||
"spring-boot-flyway",
|
||||
"spring-boot-freemarker",
|
||||
"spring-boot-groovy-templates",
|
||||
"spring-boot-gson",
|
||||
"spring-boot-hazelcast",
|
||||
"spring-boot-integration",
|
||||
"spring-boot-jackson",
|
||||
|
||||
@@ -90,6 +90,7 @@ dependencies {
|
||||
autoConfiguration(project(path: ":spring-boot-project:spring-boot-elasticsearch", configuration: "autoConfigurationMetadata"))
|
||||
autoConfiguration(project(path: ":spring-boot-project:spring-boot-flyway", configuration: "autoConfigurationMetadata"))
|
||||
autoConfiguration(project(path: ":spring-boot-project:spring-boot-freemarker", configuration: "autoConfigurationMetadata"))
|
||||
autoConfiguration(project(path: ":spring-boot-project:spring-boot-gson", configuration: "autoConfigurationMetadata"))
|
||||
autoConfiguration(project(path: ":spring-boot-project:spring-boot-hazelcast", configuration: "autoConfigurationMetadata"))
|
||||
autoConfiguration(project(path: ":spring-boot-project:spring-boot-integration", configuration: "autoConfigurationMetadata"))
|
||||
autoConfiguration(project(path: ":spring-boot-project:spring-boot-jackson", configuration: "autoConfigurationMetadata"))
|
||||
@@ -136,6 +137,7 @@ dependencies {
|
||||
configurationProperties(project(path: ":spring-boot-project:spring-boot-elasticsearch", configuration: "configurationPropertiesMetadata"))
|
||||
configurationProperties(project(path: ":spring-boot-project:spring-boot-flyway", configuration: "configurationPropertiesMetadata"))
|
||||
configurationProperties(project(path: ":spring-boot-project:spring-boot-freemarker", configuration: "configurationPropertiesMetadata"))
|
||||
configurationProperties(project(path: ":spring-boot-project:spring-boot-gson", configuration: "configurationPropertiesMetadata"))
|
||||
configurationProperties(project(path: ":spring-boot-project:spring-boot-hazelcast", configuration: "configurationPropertiesMetadata"))
|
||||
configurationProperties(project(path: ":spring-boot-project:spring-boot-integration", configuration: "configurationPropertiesMetadata"))
|
||||
configurationProperties(project(path: ":spring-boot-project:spring-boot-jackson", configuration: "configurationPropertiesMetadata"))
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright 2012-present the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License);
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
plugins {
|
||||
id "java-library"
|
||||
id "org.springframework.boot.auto-configuration"
|
||||
id "org.springframework.boot.configuration-properties"
|
||||
id "org.springframework.boot.deployed"
|
||||
id "org.springframework.boot.optional-dependencies"
|
||||
}
|
||||
|
||||
description = "Spring Boot GSON"
|
||||
|
||||
dependencies {
|
||||
api(project(":spring-boot-project:spring-boot"))
|
||||
api("com.google.code.gson:gson")
|
||||
|
||||
optional(project(":spring-boot-project:spring-boot-autoconfigure"))
|
||||
|
||||
testImplementation(project(":spring-boot-project:spring-boot-test"))
|
||||
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
|
||||
|
||||
testRuntimeOnly("ch.qos.logback:logback-classic")
|
||||
}
|
||||
+2
-2
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.gson;
|
||||
package org.springframework.boot.gson.autoconfigure;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
@@ -38,7 +38,7 @@ import org.springframework.util.ClassUtils;
|
||||
*
|
||||
* @author David Liu
|
||||
* @author Ivan Golovko
|
||||
* @since 1.2.0
|
||||
* @since 4.0.0
|
||||
*/
|
||||
@AutoConfiguration
|
||||
@ConditionalOnClass(Gson.class)
|
||||
+2
-2
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.gson;
|
||||
package org.springframework.boot.gson.autoconfigure;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
@@ -24,7 +24,7 @@ import com.google.gson.GsonBuilder;
|
||||
* {@link Gson} through {@link GsonBuilder} retaining its default auto-configuration.
|
||||
*
|
||||
* @author Ivan Golovko
|
||||
* @since 2.0.0
|
||||
* @since 4.0.0
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface GsonBuilderCustomizer {
|
||||
+2
-4
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.gson;
|
||||
package org.springframework.boot.gson.autoconfigure;
|
||||
|
||||
import com.google.gson.FieldNamingPolicy;
|
||||
import com.google.gson.Gson;
|
||||
@@ -27,7 +27,7 @@ import org.springframework.boot.context.properties.DeprecatedConfigurationProper
|
||||
* Configuration properties to configure {@link Gson}.
|
||||
*
|
||||
* @author Ivan Golovko
|
||||
* @since 2.0.0
|
||||
* @since 4.0.0
|
||||
*/
|
||||
@ConfigurationProperties("spring.gson")
|
||||
public class GsonProperties {
|
||||
@@ -193,8 +193,6 @@ public class GsonProperties {
|
||||
* Enumeration of levels of strictness. Values are the same as those on
|
||||
* {@link com.google.gson.Strictness} that was introduced in Gson 2.11. To maximize
|
||||
* backwards compatibility, the Gson enum is not used directly.
|
||||
*
|
||||
* @since 3.4.2
|
||||
*/
|
||||
public enum Strictness {
|
||||
|
||||
+1
-1
@@ -17,4 +17,4 @@
|
||||
/**
|
||||
* Auto-configuration for GSON.
|
||||
*/
|
||||
package org.springframework.boot.autoconfigure.gson;
|
||||
package org.springframework.boot.gson.autoconfigure;
|
||||
+1
@@ -0,0 +1 @@
|
||||
org.springframework.boot.gson.autoconfigure.GsonAutoConfiguration
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.gson;
|
||||
package org.springframework.boot.gson.autoconfigure;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import org.junit.jupiter.api.Test;
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.gson;
|
||||
package org.springframework.boot.gson.autoconfigure;
|
||||
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.gson;
|
||||
package org.springframework.boot.gson.autoconfigure;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
@@ -120,6 +120,7 @@ dependencies {
|
||||
testImplementation(project(":spring-boot-project:spring-boot-actuator"))
|
||||
testImplementation(project(":spring-boot-project:spring-boot-actuator-autoconfigure"))
|
||||
testImplementation(project(":spring-boot-project:spring-boot-freemarker"))
|
||||
testImplementation(project(":spring-boot-project:spring-boot-gson"))
|
||||
testImplementation(project(":spring-boot-project:spring-boot-mustache"))
|
||||
testImplementation(project(":spring-boot-project:spring-boot-testcontainers"))
|
||||
testImplementation(project(":spring-boot-project:spring-boot-thymeleaf"))
|
||||
|
||||
+3
-4
@@ -38,7 +38,6 @@ import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBooleanProperty;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.gson.GsonAutoConfiguration;
|
||||
import org.springframework.boot.test.json.AbstractJsonMarshalTester;
|
||||
import org.springframework.boot.test.json.BasicJsonTester;
|
||||
import org.springframework.boot.test.json.GsonTester;
|
||||
@@ -60,9 +59,9 @@ import org.springframework.util.ReflectionUtils;
|
||||
* @since 1.4.0
|
||||
* @see AutoConfigureJsonTesters
|
||||
*/
|
||||
@AutoConfiguration(after = { GsonAutoConfiguration.class },
|
||||
afterName = { "org.springframework.boot.jackson.autoconfigure.JacksonAutoConfiguration",
|
||||
"org.springframework.boot.jsonb.autoconfigure.JsonbAutoConfiguration" })
|
||||
@AutoConfiguration(afterName = { "org.springframework.boot.jackson.autoconfigure.JacksonAutoConfiguration",
|
||||
"org.springframework.boot.jsonb.autoconfigure.JsonbAutoConfiguration",
|
||||
"org.springframework.boot.gson.autoconfigure.GsonAutoConfiguration" })
|
||||
@ConditionalOnClass(name = "org.assertj.core.api.Assert")
|
||||
@ConditionalOnBooleanProperty("spring.test.jsontesters.enabled")
|
||||
public class JsonTestersAutoConfiguration {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
# AutoConfigureJson auto-configuration imports
|
||||
org.springframework.boot.autoconfigure.gson.GsonAutoConfiguration
|
||||
optional:org.springframework.boot.gson.autoconfigure.GsonAutoConfiguration
|
||||
org.springframework.boot.jackson.autoconfigure.JacksonAutoConfiguration
|
||||
optional:org.springframework.boot.jsonb.autoconfigure.JsonbAutoConfiguration
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ import org.springframework.aot.hint.RuntimeHints;
|
||||
import org.springframework.aot.hint.predicate.ReflectionHintsPredicates;
|
||||
import org.springframework.aot.hint.predicate.RuntimeHintsPredicates;
|
||||
import org.springframework.aot.test.generate.TestGenerationContext;
|
||||
import org.springframework.boot.autoconfigure.gson.GsonAutoConfiguration;
|
||||
import org.springframework.boot.gson.autoconfigure.GsonAutoConfiguration;
|
||||
import org.springframework.boot.jackson.autoconfigure.JacksonAutoConfiguration;
|
||||
import org.springframework.boot.jsonb.autoconfigure.JsonbAutoConfiguration;
|
||||
import org.springframework.boot.test.json.BasicJsonTester;
|
||||
|
||||
Reference in New Issue
Block a user