Categories
java spring spring-data

Scanning Spring Data repositories by Spring Config?

I’m trying to use spring data and spring config together in a small standalone application.

...
public static void main( String[] args )
{
ApplicationContext ctx = new AnnotationConfigApplicationContext(AppConfig.class);
...
}

1. My question is how can I discover the spring data repositories without using

<jpa:repositories base-package="foo.repositories" />

by spring config ?

2. If not, can I use ‘ClassPathXmlApplicationContext’ and ‘AnnotationConfigApplicationContext’ together somehow ?

This answer is now out of date.

Currently there’s no equivalent for <jpa:repositories … /> yet. Feel free tor track the according JIRA ticket. The feature will be a major one for the upcoming GA releases of the JPA module (1.1) as well as MongoDB (1.1).