Browse Source

Create spring-boot-jsonb module

Closes gh-46080
pull/46230/head
Brian Clozel 9 months ago committed by Andy Wilkinson
parent
commit
7471d01a72
  1. 1
      settings.gradle
  2. 1
      spring-boot-project/spring-boot-actuator-autoconfigure/build.gradle
  3. 2
      spring-boot-project/spring-boot-actuator/build.gradle
  4. 1
      spring-boot-project/spring-boot-autoconfigure-all/build.gradle
  5. 4
      spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/elasticsearch/ElasticsearchClientAutoConfiguration.java
  6. 6
      spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/http/HttpMessageConvertersAutoConfiguration.java
  7. 1
      spring-boot-project/spring-boot-autoconfigure-all/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
  8. 2
      spring-boot-project/spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/elasticsearch/ElasticsearchClientAutoConfigurationTests.java
  9. 2
      spring-boot-project/spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/http/HttpMessageConvertersAutoConfigurationTests.java
  10. 1
      spring-boot-project/spring-boot-dependencies/build.gradle
  11. 2
      spring-boot-project/spring-boot-docs/build.gradle
  12. 38
      spring-boot-project/spring-boot-jsonb/build.gradle
  13. 2
      spring-boot-project/spring-boot-jsonb/src/main/java/org/springframework/boot/jsonb/autoconfigure/JsonbAutoConfiguration.java
  14. 2
      spring-boot-project/spring-boot-jsonb/src/main/java/org/springframework/boot/jsonb/autoconfigure/package-info.java
  15. 1
      spring-boot-project/spring-boot-jsonb/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
  16. 2
      spring-boot-project/spring-boot-jsonb/src/test/java/org/springframework/boot/jsonb/autoconfigure/JsonbAutoConfigurationTests.java
  17. 2
      spring-boot-project/spring-boot-jsonb/src/test/java/org/springframework/boot/jsonb/autoconfigure/JsonbAutoConfigurationWithNoProviderTests.java
  18. 1
      spring-boot-project/spring-boot-test-autoconfigure/build.gradle
  19. 6
      spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/json/JsonTestersAutoConfiguration.java
  20. 2
      spring-boot-project/spring-boot-test-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.test.autoconfigure.data.elasticsearch.AutoConfigureDataElasticsearch.imports
  21. 2
      spring-boot-project/spring-boot-test-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.test.autoconfigure.json.AutoConfigureJson.imports
  22. 2
      spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/json/JsonTestersAutoConfigurationTests.java

1
settings.gradle

@ -67,6 +67,7 @@ include "spring-boot-project:spring-boot-docker-compose" @@ -67,6 +67,7 @@ include "spring-boot-project:spring-boot-docker-compose"
include "spring-boot-project:spring-boot-docs"
include "spring-boot-project:spring-boot-jackson"
include "spring-boot-project:spring-boot-jetty"
include "spring-boot-project:spring-boot-jsonb"
include "spring-boot-project:spring-boot-mail"
include "spring-boot-project:spring-boot-parent"
include "spring-boot-project:spring-boot-reactor-netty"

1
spring-boot-project/spring-boot-actuator-autoconfigure/build.gradle

@ -36,6 +36,7 @@ dependencies { @@ -36,6 +36,7 @@ dependencies {
optional(project(":spring-boot-project:spring-boot-amqp"))
optional(project(":spring-boot-project:spring-boot-jackson"))
optional(project(":spring-boot-project:spring-boot-jetty"))
optional(project(":spring-boot-project:spring-boot-jsonb"))
optional(project(":spring-boot-project:spring-boot-mail"))
optional(project(":spring-boot-project:spring-boot-reactor-netty"))
optional(project(":spring-boot-project:spring-boot-tomcat"))

2
spring-boot-project/spring-boot-actuator/build.gradle

@ -40,6 +40,7 @@ dependencies { @@ -40,6 +40,7 @@ dependencies {
dockerTestImplementation("org.testcontainers:testcontainers")
optional(project(":spring-boot-project:spring-boot-jetty"))
optional(project(":spring-boot-project:spring-boot-jsonb"))
optional(project(":spring-boot-project:spring-boot-reactor-netty"))
optional(project(":spring-boot-project:spring-boot-tomcat"))
optional(project(":spring-boot-project:spring-boot-undertow"))
@ -109,6 +110,7 @@ dependencies { @@ -109,6 +110,7 @@ dependencies {
testImplementation(project(":spring-boot-project:spring-boot-autoconfigure-all"))
testImplementation(project(":spring-boot-project:spring-boot-jackson"))
testImplementation(project(":spring-boot-project:spring-boot-jsonb"))
testImplementation(project(":spring-boot-project:spring-boot-reactor-netty"))
testImplementation(project(":spring-boot-project:spring-boot-test"))
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))

1
spring-boot-project/spring-boot-autoconfigure-all/build.gradle

@ -60,6 +60,7 @@ dependencies { @@ -60,6 +60,7 @@ dependencies {
dockerTestImplementation("org.testcontainers:testcontainers")
optional(project(":spring-boot-project:spring-boot-jackson"))
optional(project(":spring-boot-project:spring-boot-jsonb"))
optional(project(":spring-boot-project:spring-boot-reactor-netty"))
optional(project(":spring-boot-project:spring-boot-tomcat"))
optional("co.elastic.clients:elasticsearch-java")

4
spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/elasticsearch/ElasticsearchClientAutoConfiguration.java

@ -26,7 +26,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; @@ -26,7 +26,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.elasticsearch.ElasticsearchClientConfigurations.ElasticsearchClientConfiguration;
import org.springframework.boot.autoconfigure.elasticsearch.ElasticsearchClientConfigurations.ElasticsearchTransportConfiguration;
import org.springframework.boot.autoconfigure.elasticsearch.ElasticsearchClientConfigurations.JsonpMapperConfiguration;
import org.springframework.boot.autoconfigure.jsonb.JsonbAutoConfiguration;
import org.springframework.context.annotation.Import;
/**
@ -35,7 +34,8 @@ import org.springframework.context.annotation.Import; @@ -35,7 +34,8 @@ import org.springframework.context.annotation.Import;
* @author Andy Wilkinson
* @since 3.0.0
*/
@AutoConfiguration(after = { JsonbAutoConfiguration.class, ElasticsearchRestClientAutoConfiguration.class })
@AutoConfiguration(after = { ElasticsearchRestClientAutoConfiguration.class },
afterName = { "org.springframework.boot.jsonb.autoconfigure.JsonbAutoConfiguration" })
@ConditionalOnBean(RestClient.class)
@ConditionalOnClass(ElasticsearchClient.class)
@Import({ JsonpMapperConfiguration.class, ElasticsearchTransportConfiguration.class,

6
spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/http/HttpMessageConvertersAutoConfiguration.java

@ -26,7 +26,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplicat @@ -26,7 +26,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplicat
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.autoconfigure.jsonb.JsonbAutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
@ -49,8 +48,9 @@ import org.springframework.http.converter.StringHttpMessageConverter; @@ -49,8 +48,9 @@ import org.springframework.http.converter.StringHttpMessageConverter;
* @author Eddú Meléndez
* @since 2.0.0
*/
@AutoConfiguration(after = { GsonAutoConfiguration.class, JsonbAutoConfiguration.class },
afterName = "org.springframework.boot.jackson.autoconfigure.JacksonAutoConfiguration")
@AutoConfiguration(after = { GsonAutoConfiguration.class },
afterName = { "org.springframework.boot.jackson.autoconfigure.JacksonAutoConfiguration",
"org.springframework.boot.jsonb.autoconfigure.JsonbAutoConfiguration" })
@ConditionalOnClass(HttpMessageConverter.class)
@Conditional(NotReactiveWebApplicationCondition.class)
@Import({ JacksonHttpMessageConvertersConfiguration.class, GsonHttpMessageConvertersConfiguration.class,

1
spring-boot-project/spring-boot-autoconfigure-all/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports

@ -75,7 +75,6 @@ org.springframework.boot.autoconfigure.jms.JndiConnectionFactoryAutoConfiguratio @@ -75,7 +75,6 @@ org.springframework.boot.autoconfigure.jms.JndiConnectionFactoryAutoConfiguratio
org.springframework.boot.autoconfigure.jms.activemq.ActiveMQAutoConfiguration
org.springframework.boot.autoconfigure.jms.artemis.ArtemisAutoConfiguration
org.springframework.boot.autoconfigure.jooq.JooqAutoConfiguration
org.springframework.boot.autoconfigure.jsonb.JsonbAutoConfiguration
org.springframework.boot.autoconfigure.kafka.KafkaAutoConfiguration
org.springframework.boot.autoconfigure.ldap.embedded.EmbeddedLdapAutoConfiguration
org.springframework.boot.autoconfigure.ldap.LdapAutoConfiguration

2
spring-boot-project/spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/elasticsearch/ElasticsearchClientAutoConfigurationTests.java

@ -28,8 +28,8 @@ import org.elasticsearch.client.RestClient; @@ -28,8 +28,8 @@ import org.elasticsearch.client.RestClient;
import org.junit.jupiter.api.Test;
import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.autoconfigure.jsonb.JsonbAutoConfiguration;
import org.springframework.boot.jackson.autoconfigure.JacksonAutoConfiguration;
import org.springframework.boot.jsonb.autoconfigure.JsonbAutoConfiguration;
import org.springframework.boot.test.context.FilteredClassLoader;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import org.springframework.context.annotation.Bean;

2
spring-boot-project/spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/http/HttpMessageConvertersAutoConfigurationTests.java

@ -27,9 +27,9 @@ import org.springframework.beans.factory.config.BeanDefinition; @@ -27,9 +27,9 @@ 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.jsonb.JsonbAutoConfiguration;
import org.springframework.boot.autoconfigure.web.ServerProperties;
import org.springframework.boot.jackson.autoconfigure.JacksonAutoConfiguration;
import org.springframework.boot.jsonb.autoconfigure.JsonbAutoConfiguration;
import org.springframework.boot.test.context.FilteredClassLoader;
import org.springframework.boot.test.context.assertj.AssertableApplicationContext;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;

1
spring-boot-project/spring-boot-dependencies/build.gradle

@ -1996,6 +1996,7 @@ bom { @@ -1996,6 +1996,7 @@ bom {
"spring-boot-jackson",
"spring-boot-jarmode-tools",
"spring-boot-jetty",
"spring-boot-jsonb",
"spring-boot-loader",
"spring-boot-loader-classic",
"spring-boot-loader-tools",

2
spring-boot-project/spring-boot-docs/build.gradle

@ -82,6 +82,7 @@ dependencies { @@ -82,6 +82,7 @@ dependencies {
autoConfiguration(project(path: ":spring-boot-project:spring-boot-devtools", configuration: "autoConfigurationMetadata"))
autoConfiguration(project(path: ":spring-boot-project:spring-boot-jackson", configuration: "autoConfigurationMetadata"))
autoConfiguration(project(path: ":spring-boot-project:spring-boot-jetty", configuration: "autoConfigurationMetadata"))
autoConfiguration(project(path: ":spring-boot-project:spring-boot-jsonb", configuration: "autoConfigurationMetadata"))
autoConfiguration(project(path: ":spring-boot-project:spring-boot-mail", configuration: "autoConfigurationMetadata"))
autoConfiguration(project(path: ":spring-boot-project:spring-boot-reactor-netty", configuration: "autoConfigurationMetadata"))
autoConfiguration(project(path: ":spring-boot-project:spring-boot-testcontainers", configuration: "autoConfigurationMetadata"))
@ -115,6 +116,7 @@ dependencies { @@ -115,6 +116,7 @@ dependencies {
implementation(project(path: ":spring-boot-project:spring-boot-devtools"))
implementation(project(path: ":spring-boot-project:spring-boot-docker-compose"))
implementation(project(path: ":spring-boot-project:spring-boot-jackson"))
implementation(project(path: ":spring-boot-project:spring-boot-jsonb"))
implementation(project(path: ":spring-boot-project:spring-boot-reactor-netty"))
implementation(project(path: ":spring-boot-project:spring-boot-test"))
implementation(project(path: ":spring-boot-project:spring-boot-test-autoconfigure"))

38
spring-boot-project/spring-boot-jsonb/build.gradle

@ -0,0 +1,38 @@ @@ -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.deployed"
id "org.springframework.boot.optional-dependencies"
}
description = "Spring Boot JSON-B"
dependencies {
api(project(":spring-boot-project:spring-boot"))
api("jakarta.json.bind:jakarta.json.bind-api")
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"))
testImplementation("org.eclipse:yasson")
testRuntimeOnly("ch.qos.logback:logback-classic")
}

2
spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/jsonb/JsonbAutoConfiguration.java → spring-boot-project/spring-boot-jsonb/src/main/java/org/springframework/boot/jsonb/autoconfigure/JsonbAutoConfiguration.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.jsonb;
package org.springframework.boot.jsonb.autoconfigure;
import jakarta.json.bind.Jsonb;
import jakarta.json.bind.JsonbBuilder;

2
spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/jsonb/package-info.java → spring-boot-project/spring-boot-jsonb/src/main/java/org/springframework/boot/jsonb/autoconfigure/package-info.java

@ -17,4 +17,4 @@ @@ -17,4 +17,4 @@
/**
* Auto-configuration for JSON-B.
*/
package org.springframework.boot.autoconfigure.jsonb;
package org.springframework.boot.jsonb.autoconfigure;

1
spring-boot-project/spring-boot-jsonb/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports

@ -0,0 +1 @@ @@ -0,0 +1 @@
org.springframework.boot.jsonb.autoconfigure.JsonbAutoConfiguration

2
spring-boot-project/spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/jsonb/JsonbAutoConfigurationTests.java → spring-boot-project/spring-boot-jsonb/src/test/java/org/springframework/boot/jsonb/autoconfigure/JsonbAutoConfigurationTests.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.jsonb;
package org.springframework.boot.jsonb.autoconfigure;
import jakarta.json.bind.Jsonb;
import org.junit.jupiter.api.Test;

2
spring-boot-project/spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/jsonb/JsonbAutoConfigurationWithNoProviderTests.java → spring-boot-project/spring-boot-jsonb/src/test/java/org/springframework/boot/jsonb/autoconfigure/JsonbAutoConfigurationWithNoProviderTests.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.jsonb;
package org.springframework.boot.jsonb.autoconfigure;
import jakarta.json.bind.Jsonb;
import org.junit.jupiter.api.Test;

1
spring-boot-project/spring-boot-test-autoconfigure/build.gradle

@ -52,6 +52,7 @@ dependencies { @@ -52,6 +52,7 @@ dependencies {
dockerTestRuntimeOnly("org.springframework.data:spring-data-redis")
optional(project(":spring-boot-project:spring-boot-jackson"))
optional(project(":spring-boot-project:spring-boot-jsonb"))
optional(project(":spring-boot-project:spring-boot-reactor-netty"))
optional("jakarta.json.bind:jakarta.json.bind-api")
optional("jakarta.persistence:jakarta.persistence-api")

6
spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/json/JsonTestersAutoConfiguration.java

@ -39,7 +39,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; @@ -39,7 +39,6 @@ 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.autoconfigure.jsonb.JsonbAutoConfiguration;
import org.springframework.boot.test.json.AbstractJsonMarshalTester;
import org.springframework.boot.test.json.BasicJsonTester;
import org.springframework.boot.test.json.GsonTester;
@ -61,8 +60,9 @@ import org.springframework.util.ReflectionUtils; @@ -61,8 +60,9 @@ import org.springframework.util.ReflectionUtils;
* @since 1.4.0
* @see AutoConfigureJsonTesters
*/
@AutoConfiguration(after = { GsonAutoConfiguration.class, JsonbAutoConfiguration.class },
afterName = "org.springframework.boot.jackson.autoconfigure.JacksonAutoConfiguration")
@AutoConfiguration(after = { GsonAutoConfiguration.class },
afterName = { "org.springframework.boot.jackson.autoconfigure.JacksonAutoConfiguration",
"org.springframework.boot.jsonb.autoconfigure.JsonbAutoConfiguration" })
@ConditionalOnClass(name = "org.assertj.core.api.Assert")
@ConditionalOnBooleanProperty("spring.test.jsontesters.enabled")
public class JsonTestersAutoConfiguration {

2
spring-boot-project/spring-boot-test-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.test.autoconfigure.data.elasticsearch.AutoConfigureDataElasticsearch.imports

@ -5,7 +5,7 @@ org.springframework.boot.autoconfigure.data.elasticsearch.ReactiveElasticsearchR @@ -5,7 +5,7 @@ org.springframework.boot.autoconfigure.data.elasticsearch.ReactiveElasticsearchR
org.springframework.boot.autoconfigure.elasticsearch.ElasticsearchClientAutoConfiguration
org.springframework.boot.autoconfigure.elasticsearch.ElasticsearchRestClientAutoConfiguration
org.springframework.boot.autoconfigure.elasticsearch.ReactiveElasticsearchClientAutoConfiguration
org.springframework.boot.autoconfigure.jsonb.JsonbAutoConfiguration
org.springframework.boot.autoconfigure.ssl.SslAutoConfiguration
org.springframework.boot.jackson.autoconfigure.JacksonAutoConfiguration
optional:org.springframework.boot.jsonb.autoconfigure.JsonbAutoConfiguration
optional:org.springframework.boot.testcontainers.service.connection.ServiceConnectionAutoConfiguration

2
spring-boot-project/spring-boot-test-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.test.autoconfigure.json.AutoConfigureJson.imports

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
# AutoConfigureJson auto-configuration imports
org.springframework.boot.autoconfigure.gson.GsonAutoConfiguration
org.springframework.boot.autoconfigure.jsonb.JsonbAutoConfiguration
org.springframework.boot.jackson.autoconfigure.JacksonAutoConfiguration
optional:org.springframework.boot.jsonb.autoconfigure.JsonbAutoConfiguration

2
spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/json/JsonTestersAutoConfigurationTests.java

@ -25,8 +25,8 @@ import org.springframework.aot.hint.predicate.ReflectionHintsPredicates; @@ -25,8 +25,8 @@ 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.autoconfigure.jsonb.JsonbAutoConfiguration;
import org.springframework.boot.jackson.autoconfigure.JacksonAutoConfiguration;
import org.springframework.boot.jsonb.autoconfigure.JsonbAutoConfiguration;
import org.springframework.boot.test.json.BasicJsonTester;
import org.springframework.boot.test.json.GsonTester;
import org.springframework.boot.test.json.JacksonTester;

Loading…
Cancel
Save