繁体   English   中英

Spring LDAP示例需要持久性吗?

[英]Spring LDAP example requires persistence?

我是Spring和LDAP的新手。 我发现了一个很棒的例子,解释了如何快速启动spring boot和apacheds。 我通过使用建议的Gradle配置来跟踪示例。 链接 当我开始弹簧启动时,我收到以下错误...


 Error creating bean with name 'persistenceExceptionTranslationPostProcessor' defined in class path resource [org/springframework/boot/autoconfigure/dao/PersistenceExceptionTranslationAutoConfiguration.class]: Initialization of bean failed; nested exception is java.lang.IllegalStateException: No persistence exception translators found in bean factory. Cannot perform exception translation.

我不确定为什么Spring要求持久性转换器,但是通过搜索其他帖子看来,类路径中有一个ORM(我没有加载ORM JAR,如果弹出安全启动项被删除则不会发生异常来自gradle)这就是为什么Spring正在寻找JPA实现和翻译器。 其他人对链接中的示例有疑问。 谢谢!

问题是spring-security-ldapspring-tx有传递依赖性,并且被引入的版本是3.2.8.RELEASE。 Spring Boot 1.2需要4.1.x. Maven不会因为其出色的依赖管理而发生这种情况。

您可以通过在spring-tx上添加显式依赖项来解决问题。 没有必要指定一个版本,因为Spring Boot会为您处理这个问题。 根据您在问题中链接的示例,这将使您的依赖项看起来像这样:

dependencies {
    compile("org.springframework.boot:spring-boot-starter-web")
    compile("org.springframework.boot:spring-boot-starter-security")
    compile("org.springframework:spring-tx")
    compile("org.springframework.security:spring-security-ldap:3.2.4.RELEASE")
    compile("org.apache.directory.server:apacheds-server-jndi:1.5.5")
    testCompile("junit:junit")
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM