XML配置

每一个Spring Data模块都包含repositories元素能够让你简单的基于base-package定义来进行Spring扫描。

示例13。 通过XML来开启Spring Data repositories

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans:beans xmlns:beans="http://www.springframework.org/schema/beans"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xmlns="http://www.springframework.org/schema/data/jpa"
  5. xsi:schemaLocation="http://www.springframework.org/schema/beans
  6. http://www.springframework.org/schema/beans/spring-beans.xsd
  7. http://www.springframework.org/schema/data/jpa
  8. http://www.springframework.org/schema/data/jpa/spring-jpa.xsd">
  9. <repositories base-package="com.acme.repositories" />
  10. </beans:beans>