csc*_*aba 15 java spring spring-data
我试图在一个小型独立应用程序中一起使用spring数据和spring配置.
...
public static void main( String[] args )
{
ApplicationContext ctx = new AnnotationConfigApplicationContext(AppConfig.class);
...
}
Run Code Online (Sandbox Code Playgroud)
1.我的问题是如何在不使用的情况下发现spring数据存储库
<jpa:repositories base-package="foo.repositories" />
Run Code Online (Sandbox Code Playgroud)
通过spring config?
2.如果没有,我可以以某种方式一起使用'ClassPathXmlApplicationContext'和'AnnotationConfigApplicationContext'吗?
Abd*_*ull 63
您现在可以使用注释@EnableJpaRepositories("some.root.package").
例如:
@Configuration
@EnableTransactionManagement(proxyTargetClass = true)
@EnableJpaRepositories("some.root.package")
@ComponentScan(basePackages = { "maybe.another.root.package" })
public class SystemConfiguration {
...
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
28738 次 |
| 最近记录: |