質問

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