简体   繁体   English

Spring LDAP示例需要持久性吗?

[英]Spring LDAP example requires persistence?

I am new to Spring and LDAP. 我是Spring和LDAP的新手。 I found an awesome example that explains how to quickly start with spring boot and apacheds. 我发现了一个很棒的例子,解释了如何快速启动spring boot和apacheds。 I followed the example by using the suggested Gradle configuration. 我通过使用建议的Gradle配置来跟踪示例。 The link . 链接 When I start spring boot I receive the following error... 当我开始弹簧启动时,我收到以下错误...


 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.

I am not sure why Spring is asking for the persistence translator though from searching through other postings it appears there is an ORM within the classpath (I haven't loaded an ORM JAR and the exception does not occur if the spring security boot entry is removed from gradle) and this is why Spring is looking for a JPA implementation and the translator. 我不确定为什么Spring要求持久性转换器,但是通过搜索其他帖子看来,类路径中有一个ORM(我没有加载ORM JAR,如果弹出安全启动项被删除则不会发生异常来自gradle)这就是为什么Spring正在寻找JPA实现和翻译器。 Anyone else have issue with the example from the link. 其他人对链接中的示例有疑问。 Thanks! 谢谢!

The problem is that spring-security-ldap has a transitive dependency on spring-tx and the version that's being pulled in is 3.2.8.RELEASE. 问题是spring-security-ldapspring-tx有传递依赖性,并且被引入的版本是3.2.8.RELEASE。 Spring Boot 1.2 requires 4.1.x. Spring Boot 1.2需要4.1.x. This doesn't happen with Maven due to its superior dependency management. Maven不会因为其出色的依赖管理而发生这种情况。

You can fix the problem by adding an explicit dependency on spring-tx . 您可以通过在spring-tx上添加显式依赖项来解决问题。 There's no need to specify a version as Spring Boot will take care of this for you. 没有必要指定一个版本,因为Spring Boot会为您处理这个问题。 Based on the example that you linked to in the question, this will leave your dependencies looking like this: 根据您在问题中链接的示例,这将使您的依赖项看起来像这样:

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