Create spring-boot-gson module
This commit is contained in:
committed by
Phillip Webb
parent
8561dd7680
commit
ee0c4af6d3
@@ -62,6 +62,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"
|
||||
|
||||
@@ -67,7 +67,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")
|
||||
@@ -204,6 +203,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"))
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -1995,6 +1995,7 @@ bom {
|
||||
"spring-boot-flyway",
|
||||
"spring-boot-freemarker",
|
||||
"spring-boot-groovy-templates",
|
||||
"spring-boot-gson",
|
||||
"spring-boot-hazelcast",
|
||||
"spring-boot-integration",
|
||||
"spring-boot-jackson",
|
||||
|
||||
@@ -74,6 +74,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"))
|
||||
@@ -120,6 +121,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"))
|
||||
|
||||
21
spring-boot-project/spring-boot-gson/build.gradle
Normal file
21
spring-boot-project/spring-boot-gson/build.gradle
Normal file
@@ -0,0 +1,21 @@
|
||||
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")
|
||||
}
|
||||
@@ -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)
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
* Copyright 2012-2025 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.
|
||||
@@ -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 {
|
||||
@@ -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,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2025 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.
|
||||
@@ -17,4 +17,4 @@
|
||||
/**
|
||||
* Auto-configuration for GSON.
|
||||
*/
|
||||
package org.springframework.boot.autoconfigure.gson;
|
||||
package org.springframework.boot.gson.autoconfigure;
|
||||
@@ -0,0 +1 @@
|
||||
org.springframework.boot.gson.autoconfigure.GsonAutoConfiguration
|
||||
@@ -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,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
* Copyright 2012-2025 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.
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -103,6 +103,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"))
|
||||
|
||||
@@ -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,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,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2025 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.
|
||||
@@ -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