Create spring-boot-data-ldap module

This commit is contained in:
Stéphane Nicoll
2025-03-25 10:58:46 +01:00
committed by Phillip Webb
parent 26183f1edf
commit b2b849b30d
19 changed files with 60 additions and 39 deletions

View File

@@ -53,6 +53,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

@@ -52,7 +52,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"))
@@ -106,7 +105,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")
@@ -171,7 +169,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,22 @@
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

@@ -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.data.ldap;
package org.springframework.boot.data.ldap.autoconfigure;
import java.lang.annotation.Annotation;

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

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

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

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

@@ -1988,6 +1988,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

@@ -69,6 +69,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"))
@@ -111,6 +112,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

@@ -6,7 +6,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

@@ -39,6 +39,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"))
@@ -46,7 +47,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