簡體   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