Create spring-boot-data-web module

This commit is contained in:
Stéphane Nicoll 2025-03-30 08:35:56 +02:00 committed by Andy Wilkinson
parent 843d30038e
commit 6b769ebd98
17 changed files with 59 additions and 14 deletions

View File

@ -63,6 +63,7 @@ include "spring-boot-project:spring-boot-data-neo4j"
include "spring-boot-project:spring-boot-data-r2dbc"
include "spring-boot-project:spring-boot-data-redis"
include "spring-boot-project:spring-boot-data-rest"
include "spring-boot-project:spring-boot-data-web"
include "spring-boot-project:spring-boot-dependencies"
include "spring-boot-project:spring-boot-devtools"
include "spring-boot-project:spring-boot-docker-compose"

View File

@ -1,7 +1,6 @@
org.springframework.boot.autoconfigure.aop.AopAutoConfiguration
org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration
org.springframework.boot.autoconfigure.dao.PersistenceExceptionTranslationAutoConfiguration
org.springframework.boot.autoconfigure.data.web.SpringDataWebAutoConfiguration
org.springframework.boot.autoconfigure.graphql.GraphQlAutoConfiguration
org.springframework.boot.autoconfigure.graphql.data.GraphQlReactiveQueryByExampleAutoConfiguration
org.springframework.boot.autoconfigure.graphql.data.GraphQlReactiveQuerydslAutoConfiguration

View File

@ -0,0 +1,26 @@
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 New Project"
dependencies {
api(project(":spring-boot-project:spring-boot-webmvc"))
api("org.springframework.data:spring-data-commons")
optional(project(":spring-boot-project:spring-boot-autoconfigure"))
testImplementation(project(":spring-boot-project:spring-boot-data-jpa"))
testImplementation(project(":spring-boot-project:spring-boot-test"))
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
testImplementation(testFixtures(project(":spring-boot-project:spring-boot-autoconfigure")))
testRuntimeOnly("ch.qos.logback:logback-classic")
testRuntimeOnly("com.h2database:h2")
testRuntimeOnly("com.zaxxer:HikariCP")
testRuntimeOnly("jakarta.servlet:jakarta.servlet-api")
}

View File

@ -43,7 +43,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
* @author Andy Wilkinson
* @author Vedran Pavic
* @author Yanming Zhou
* @since 1.2.0
* @since 4.0.0
*/
@AutoConfiguration(afterName = "org.springframework.boot.data.rest.autoconfigure.RepositoryRestMvcAutoConfiguration")
@EnableSpringDataWebSupport

View File

@ -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.
@ -24,7 +24,7 @@ import org.springframework.data.web.config.EnableSpringDataWebSupport.PageSerial
*
* @author Vedran Pavic
* @author Yanming Zhou
* @since 2.0.0
* @since 4.0.0
*/
@ConfigurationProperties("spring.data.web")
public class SpringDataWebProperties {

View File

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

View File

@ -0,0 +1,4 @@
{
"groups": [],
"properties": []
}

View File

@ -0,0 +1 @@
org.springframework.boot.autoconfigure.data.web.SpringDataWebAutoConfiguration

View File

@ -20,8 +20,8 @@ import org.junit.jupiter.api.Test;
import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.autoconfigure.TestAutoConfigurationPackage;
import org.springframework.boot.autoconfigure.data.alt.jpa.City;
import org.springframework.boot.autoconfigure.data.alt.jpa.CityJpaRepository;
import org.springframework.boot.autoconfigure.data.web.domain.city.City;
import org.springframework.boot.autoconfigure.data.web.domain.city.CityRepository;
import org.springframework.boot.data.jpa.autoconfigure.JpaRepositoriesAutoConfiguration;
import org.springframework.boot.jdbc.autoconfigure.DataSourceAutoConfiguration;
import org.springframework.boot.jpa.autoconfigure.hibernate.HibernateJpaAutoConfiguration;
@ -52,7 +52,7 @@ class SpringDataWebAutoConfigurationJpaTests {
@Test
void springDataWebIsConfiguredWithJpaRepositories() {
this.contextRunner.withUserConfiguration(TestConfiguration.class).run((context) -> {
assertThat(context).hasSingleBean(CityJpaRepository.class);
assertThat(context).hasSingleBean(CityRepository.class);
assertThat(context).hasSingleBean(PageableHandlerMethodArgumentResolver.class);
assertThat(context).hasSingleBean(SortHandlerMethodArgumentResolver.class);
assertThat(context.getBean(FormattingConversionService.class).canConvert(String.class, Distance.class))

View File

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

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.data.alt.jpa;
package org.springframework.boot.autoconfigure.data.web.domain.city;
import java.io.Serializable;

View File

@ -14,10 +14,19 @@
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.data.alt.jpa;
package org.springframework.boot.autoconfigure.data.web.domain.city;
import org.springframework.data.repository.Repository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
public interface CityJpaRepository extends Repository<City, Long> {
public interface CityRepository extends JpaRepository<City, Long> {
@Override
Page<City> findAll(Pageable pageable);
Page<City> findByNameLikeAndCountryLikeAllIgnoringCase(String name, String country, Pageable pageable);
City findByNameAndCountryAllIgnoringCase(String name, String country);
}

View File

@ -2036,6 +2036,7 @@ bom {
"spring-boot-data-r2dbc",
"spring-boot-data-redis",
"spring-boot-data-rest",
"spring-boot-data-web",
"spring-boot-devtools",
"spring-boot-docker-compose",
"spring-boot-elasticsearch",

View File

@ -73,6 +73,7 @@ dependencies {
autoConfiguration(project(path: ":spring-boot-project:spring-boot-data-r2dbc", configuration: "autoConfigurationMetadata"))
autoConfiguration(project(path: ":spring-boot-project:spring-boot-data-redis", configuration: "autoConfigurationMetadata"))
autoConfiguration(project(path: ":spring-boot-project:spring-boot-data-rest", configuration: "autoConfigurationMetadata"))
autoConfiguration(project(path: ":spring-boot-project:spring-boot-data-web", configuration: "autoConfigurationMetadata"))
autoConfiguration(project(path: ":spring-boot-project:spring-boot-devtools", configuration: "autoConfigurationMetadata"))
autoConfiguration(project(path: ":spring-boot-project:spring-boot-elasticsearch", configuration: "autoConfigurationMetadata"))
autoConfiguration(project(path: ":spring-boot-project:spring-boot-flyway", configuration: "autoConfigurationMetadata"))
@ -134,6 +135,7 @@ dependencies {
configurationProperties(project(path: ":spring-boot-project:spring-boot-data-r2dbc", configuration: "configurationPropertiesMetadata"))
configurationProperties(project(path: ":spring-boot-project:spring-boot-data-redis", configuration: "configurationPropertiesMetadata"))
configurationProperties(project(path: ":spring-boot-project:spring-boot-data-rest", configuration: "configurationPropertiesMetadata"))
configurationProperties(project(path: ":spring-boot-project:spring-boot-data-web", configuration: "configurationPropertiesMetadata"))
configurationProperties(project(path: ":spring-boot-project:spring-boot-devtools", configuration: "configurationPropertiesMetadata"))
configurationProperties(project(path: ":spring-boot-project:spring-boot-docker-compose", configuration: "configurationPropertiesMetadata"))
configurationProperties(project(path: ":spring-boot-project:spring-boot-elasticsearch", configuration: "configurationPropertiesMetadata"))

View File

@ -7,5 +7,6 @@ description = "Starter for exposing Spring Data repositories over REST using Spr
dependencies {
api(project(":spring-boot-project:spring-boot-starters:spring-boot-starter-web"))
api(project(":spring-boot-project:spring-boot-data-rest"))
api(project(":spring-boot-project:spring-boot-data-web"))
api(project(":spring-boot-project:spring-boot-tx"))
}

View File

@ -46,6 +46,7 @@ dependencies {
optional(project(":spring-boot-project:spring-boot-data-neo4j"))
optional(project(":spring-boot-project:spring-boot-data-r2dbc"))
optional(project(":spring-boot-project:spring-boot-data-redis"))
optional(project(":spring-boot-project:spring-boot-data-web"))
optional(project(":spring-boot-project:spring-boot-flyway"))
optional(project(":spring-boot-project:spring-boot-groovy-templates"))
optional(project(":spring-boot-project:spring-boot-hateoas"))

View File

@ -7,7 +7,7 @@ optional:org.springframework.boot.mustache.autoconfigure.MustacheAutoConfigurati
optional:org.springframework.boot.thymeleaf.autoconfigure.ThymeleafAutoConfiguration
optional:org.springframework.boot.validation.autoconfigure.ValidationAutoConfiguration
org.springframework.boot.autoconfigure.context.MessageSourceAutoConfiguration
org.springframework.boot.autoconfigure.data.web.SpringDataWebAutoConfiguration
optional:org.springframework.boot.autoconfigure.data.web.SpringDataWebAutoConfiguration
org.springframework.boot.autoconfigure.task.TaskExecutionAutoConfiguration
org.springframework.boot.autoconfigure.web.servlet.HttpEncodingAutoConfiguration
org.springframework.boot.webmvc.autoconfigure.WebMvcAutoConfiguration