문제

I'm trying to implement Spring's repositories in my DAL. I'm following this guide.

At the third step of "1.2 Query methods" paragraph we need to activate the repository package scanning with the following XML configuration

<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns:beans="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns="http://www.springframework.org/schema/data/jpa"
  xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.springframework.org/schema/data/jpa
    http://www.springframework.org/schema/data/jpa/spring-jpa.xsd">

  <repositories base-package="com.acme.repositories" />

</beans>

In my project I'm using only java config so this declaration is a little problematic for me. What is the right way to make things done in java conf in this case?

Thank you

도움이 되었습니까?

해결책

You need to add the following annotation to your configuration class:

@EnableJpaRepositories("com.acme.repositories")
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top