Может ли кто-нибудь помочь мне с правильной зависимостью String-boot, которая работает со строкой-jpa? Моя проблема, когда я использую конфигурацию ниже Gradle зависимостей я получаю сообщение об ошибкеОшибка Spring JPA-зависимой ошибки
dependencies {
compile 'org.springframework.boot:spring-boot-starter-thymeleaf'
compile 'org.springframework:spring-orm:4.2.4.RELEASE'
compile 'org.springframework.data:spring-data-jpa:1.10.5.RELEASE'
compile 'org.hibernate:hibernate-core:5.0.6.Final'
compile 'org.hibernate:hibernate-entitymanager:5.0.6.Final'
compile 'org.apache.tomcat:tomcat-dbcp:8.0.30'
compile 'org.springframework.boot:spring-boot-starter-security'
compile 'org.thymeleaf.extras:thymeleaf-extras-springsecurity4:2.1.2.RELEASE'
Ошибка
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration.setFilterChainProxySecurityConfigurer(org.springframework.security.config.annotation.ObjectPostProcessor,java.util.List) throws java.lang.Exception; nested exception is org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityConfig': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private gh.gov.moh.admissionsportal.service.UserService gh.gov.moh.admissionsportal.config.SecurityConfig.userService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private gh.gov.moh.admissionsportal.dao.UserDao gh.gov.moh.admissionsportal.service.UserServiceImpl.userDao; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDao': Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/springframework/data/repository/query/QueryByExampleExecutor
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:661) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
... 31 common frames omitted
Но когда я использую ниже конфигурации он работает нормально, но я получаю «NullPointerException в AbstractStringBasedJpaQuery "при использовании аннотации @Query и JPQL в моей конфигурации Dao.
@Repository
public interface ExamsDao extends CrudRepository<Exams,Long>{
@Query("select e from Exams e where e.user.id=:#{principal.id}")
List<Exams> findAll();
}
dependencies {
compile 'org.springframework.boot:spring-boot-starter-thymeleaf'
compile 'org.springframework:spring-orm:4.2.4.RELEASE'
compile 'org.springframework.data:spring-data-jpa:1.9.6.RELEASE'
compile 'org.hibernate:hibernate-core:5.0.6.Final'
compile 'org.hibernate:hibernate-entitymanager:5.0.6.Final'
compile 'org.apache.tomcat:tomcat-dbcp:8.0.30'
compile 'org.springframework.boot:spring-boot-starter-security'
compile 'org.thymeleaf.extras:thymeleaf-extras-springsecurity4:2.1.2.RELEASE'