Question

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

Était-ce utile?

La solution

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

@EnableJpaRepositories("com.acme.repositories")
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top