Create spring-boot-data-ldap module

Issue: 46109
This commit is contained in:
Stéphane Nicoll 2025-03-25 10:58:46 +01:00 committed by Phillip Webb
parent 55b01d29a9
commit 1e65697959
19 changed files with 72 additions and 34 deletions

View File

@ -69,6 +69,7 @@ include "spring-boot-project:spring-boot-batch"
include "spring-boot-project:spring-boot-cassandra"
include "spring-boot-project:spring-boot-couchbase"
include "spring-boot-project:spring-boot-data-jpa"
include "spring-boot-project:spring-boot-data-ldap"
include "spring-boot-project:spring-boot-dependencies"
include "spring-boot-project:spring-boot-devtools"
include "spring-boot-project:spring-boot-docker-compose"

View File

@ -69,7 +69,6 @@ dependencies {
optional(project(":spring-boot-project:spring-boot-jackson"))
optional(project(":spring-boot-project:spring-boot-jdbc"))
optional(project(":spring-boot-project:spring-boot-jsonb"))
optional(project(":spring-boot-project:spring-boot-ldap"))
optional(project(":spring-boot-project:spring-boot-liquibase"))
optional(project(":spring-boot-project:spring-boot-neo4j"))
optional(project(":spring-boot-project:spring-boot-r2dbc"))
@ -123,7 +122,6 @@ dependencies {
optional("com.github.ben-manes.caffeine:caffeine")
optional("com.github.mxab.thymeleaf.extras:thymeleaf-extras-data-attribute")
optional("com.sendgrid:sendgrid-java")
optional("com.unboundid:unboundid-ldapsdk")
optional("com.zaxxer:HikariCP")
optional("nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect")
optional("org.aspectj:aspectjweaver")
@ -188,7 +186,6 @@ dependencies {
exclude group: "org.elasticsearch.client", module: "transport"
}
optional("org.springframework.data:spring-data-jdbc")
optional("org.springframework.data:spring-data-ldap")
optional("org.springframework.data:spring-data-mongodb")
optional("org.springframework.data:spring-data-neo4j")
optional("org.springframework.data:spring-data-r2dbc")

View File

@ -326,12 +326,6 @@
"description": "Whether to enable JDBC repositories.",
"defaultValue": true
},
{
"name": "spring.data.ldap.repositories.enabled",
"type": "java.lang.Boolean",
"description": "Whether to enable LDAP repositories.",
"defaultValue": true
},
{
"name": "spring.data.mongodb.grid-fs-database",
"type": "java.lang.String",

View File

@ -13,7 +13,6 @@ org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchDataAutoC
org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchRepositoriesAutoConfiguration
org.springframework.boot.autoconfigure.data.elasticsearch.ReactiveElasticsearchRepositoriesAutoConfiguration
org.springframework.boot.autoconfigure.data.jdbc.JdbcRepositoriesAutoConfiguration
org.springframework.boot.autoconfigure.data.ldap.LdapRepositoriesAutoConfiguration
org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration
org.springframework.boot.autoconfigure.data.mongo.MongoReactiveDataAutoConfiguration
org.springframework.boot.autoconfigure.data.mongo.MongoReactiveRepositoriesAutoConfiguration

View File

@ -0,0 +1,39 @@
/*
* 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 Data LDAP"
dependencies {
api(project(":spring-boot-project:spring-boot-ldap"))
api("org.springframework.data:spring-data-ldap")
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(testFixtures(project(":spring-boot-project:spring-boot-autoconfigure")))
testRuntimeOnly("ch.qos.logback:logback-classic")
}

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.data.ldap;
package org.springframework.boot.data.ldap.autoconfigure;
import javax.naming.ldap.LdapContext;
@ -31,7 +31,7 @@ import org.springframework.data.ldap.repository.support.LdapRepositoryFactoryBea
* {@link EnableAutoConfiguration Auto-configuration} for Spring Data's LDAP Repositories.
*
* @author Eddú Meléndez
* @since 1.5.0
* @since 4.0.0
*/
@AutoConfiguration
@ConditionalOnClass({ LdapContext.class, LdapRepository.class })

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.data.ldap;
package org.springframework.boot.data.ldap.autoconfigure;
import java.lang.annotation.Annotation;

View File

@ -17,4 +17,4 @@
/**
* Auto-configuration for Spring Data LDAP.
*/
package org.springframework.boot.autoconfigure.data.ldap;
package org.springframework.boot.data.ldap.autoconfigure;

View File

@ -0,0 +1,11 @@
{
"groups": [],
"properties": [
{
"name": "spring.data.ldap.repositories.enabled",
"type": "java.lang.Boolean",
"description": "Whether to enable LDAP repositories.",
"defaultValue": true
}
]
}

View File

@ -0,0 +1 @@
org.springframework.boot.data.ldap.autoconfigure.LdapRepositoriesAutoConfiguration

View File

@ -14,17 +14,16 @@
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.data.ldap;
package org.springframework.boot.data.ldap.autoconfigure;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.springframework.boot.autoconfigure.TestAutoConfigurationPackage;
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
import org.springframework.boot.autoconfigure.data.alt.ldap.PersonLdapRepository;
import org.springframework.boot.autoconfigure.data.empty.EmptyDataPackage;
import org.springframework.boot.autoconfigure.data.ldap.person.Person;
import org.springframework.boot.autoconfigure.data.ldap.person.PersonRepository;
import org.springframework.boot.data.ldap.autoconfigure.domain.empty.EmptyDataPackage;
import org.springframework.boot.data.ldap.autoconfigure.domain.person.Person;
import org.springframework.boot.data.ldap.autoconfigure.domain.person.PersonRepository;
import org.springframework.boot.ldap.autoconfigure.LdapAutoConfiguration;
import org.springframework.boot.test.util.TestPropertyValues;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
@ -64,7 +63,7 @@ class LdapRepositoriesAutoConfigurationTests {
@Test
void doesNotTriggerDefaultRepositoryDetectionIfCustomized() {
load(CustomizedConfiguration.class);
assertThat(this.context.getBean(PersonLdapRepository.class)).isNotNull();
assertThat(this.context.getBean(PersonRepository.class)).isNotNull();
}
private void load(Class<?>... configurationClasses) {
@ -90,7 +89,7 @@ class LdapRepositoriesAutoConfigurationTests {
@Configuration(proxyBeanMethods = false)
@TestAutoConfigurationPackage(LdapRepositoriesAutoConfigurationTests.class)
@EnableLdapRepositories(basePackageClasses = PersonLdapRepository.class)
@EnableLdapRepositories(basePackageClasses = PersonRepository.class)
static class CustomizedConfiguration {
}

View File

@ -14,13 +14,8 @@
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.data.alt.ldap;
package org.springframework.boot.data.ldap.autoconfigure.domain.empty;
import javax.naming.Name;
import org.springframework.boot.autoconfigure.data.ldap.person.Person;
import org.springframework.data.repository.Repository;
public interface PersonLdapRepository extends Repository<Person, Name> {
public class EmptyDataPackage {
}

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.data.ldap.person;
package org.springframework.boot.data.ldap.autoconfigure.domain.person;
import javax.naming.Name;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.data.ldap.person;
package org.springframework.boot.data.ldap.autoconfigure.domain.person;
import javax.naming.Name;

View File

@ -1997,6 +1997,7 @@ bom {
"spring-boot-configuration-processor",
"spring-boot-couchbase",
"spring-boot-data-jpa",
"spring-boot-data-ldap",
"spring-boot-devtools",
"spring-boot-docker-compose",
"spring-boot-elasticsearch",

View File

@ -85,6 +85,7 @@ dependencies {
autoConfiguration(project(path: ":spring-boot-project:spring-boot-cassandra", configuration: "autoConfigurationMetadata"))
autoConfiguration(project(path: ":spring-boot-project:spring-boot-couchbase", configuration: "autoConfigurationMetadata"))
autoConfiguration(project(path: ":spring-boot-project:spring-boot-data-jpa", configuration: "autoConfigurationMetadata"))
autoConfiguration(project(path: ":spring-boot-project:spring-boot-data-ldap", 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"))
@ -127,6 +128,7 @@ dependencies {
configurationProperties(project(path: ":spring-boot-project:spring-boot-cassandra", configuration: "configurationPropertiesMetadata"))
configurationProperties(project(path: ":spring-boot-project:spring-boot-couchbase", configuration: "configurationPropertiesMetadata"))
configurationProperties(project(path: ":spring-boot-project:spring-boot-data-jpa", configuration: "configurationPropertiesMetadata"))
configurationProperties(project(path: ":spring-boot-project:spring-boot-data-ldap", 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

@ -22,7 +22,6 @@ description = "Starter for using Spring Data LDAP"
dependencies {
api(project(":spring-boot-project:spring-boot-starters:spring-boot-starter"))
api(project(":spring-boot-project:spring-boot-ldap"))
api(project(":spring-boot-project:spring-boot-data-ldap"))
api(project(":spring-boot-project:spring-boot-tx"))
api("org.springframework.data:spring-data-ldap")
}

View File

@ -56,6 +56,7 @@ dependencies {
optional(project(":spring-boot-project:spring-boot-cassandra"))
optional(project(":spring-boot-project:spring-boot-couchbase"))
optional(project(":spring-boot-project:spring-boot-data-jpa"))
optional(project(":spring-boot-project:spring-boot-data-ldap"))
optional(project(":spring-boot-project:spring-boot-elasticsearch"))
optional(project(":spring-boot-project:spring-boot-flyway"))
optional(project(":spring-boot-project:spring-boot-groovy-templates"))
@ -63,7 +64,6 @@ dependencies {
optional(project(":spring-boot-project:spring-boot-jdbc"))
optional(project(":spring-boot-project:spring-boot-jooq"))
optional(project(":spring-boot-project:spring-boot-jsonb"))
optional(project(":spring-boot-project:spring-boot-ldap"))
optional(project(":spring-boot-project:spring-boot-liquibase")) {
exclude(group: "org.liquibase")
}

View File

@ -1,5 +1,5 @@
# AutoConfigureDataLdap auto-configuration imports
org.springframework.boot.autoconfigure.data.ldap.LdapRepositoriesAutoConfiguration
org.springframework.boot.data.ldap.autoconfigure.LdapRepositoriesAutoConfiguration
org.springframework.boot.ldap.autoconfigure.LdapAutoConfiguration
org.springframework.boot.ldap.autoconfigure.embedded.EmbeddedLdapAutoConfiguration
optional:org.springframework.boot.testcontainers.service.connection.ServiceConnectionAutoConfiguration