带OSGI的Spring JPA
我正在使用带OSGI的Spring JPA,spring,jpa,spring-data,Spring,Jpa,Spring Data,我正在使用OSGI尝试Spring(4.5)数据JPA,并使用基于java的Spring配置,但在扫描Spring组件/包方面面临问题。 我已经尝试了以下选项,使用 伙伴政策 碎片 但仍然面临同样的问题。我将非常感谢你在这件事上的帮助。请参阅下面我得到的错误: o、 s.core.io.support.PathMatchingResourcePatternResolver 无法在URL下搜索匹配的文件 [捆绑eresource://261.fwk57497692/com/misys/fbp/fr
OSGI
尝试Spring(4.5)数据JPA
,并使用基于java的Spring配置,但在扫描Spring组件/包方面面临问题。
我已经尝试了以下选项,使用
无法在URL下搜索匹配的文件 [捆绑eresource://261.fwk57497692/com/misys/fbp/frameworkInformation/dao/] 因为它与文件系统中的目录不对应 java.io.FileNotFoundException:URL [捆绑eresource://261.fwk57497692/com/misys/fbp/frameworkInformation/dao/] 无法解析为绝对文件路径,因为它不位于 文件系统: 捆绑eresource://261.fwk57497692/com/misys/fbp/frameworkInformation/dao/ 位于org.springframework.util.ResourceUtils.getFile(ResourceUtils.java:212) 位于org.springframework.core.io.AbstractFileResolvingerSource.getFile(AbstractFileResolvingerSource.java:52) 位于org.springframework.core.io.UrlResource.getFile(UrlResource.java:212) 位于org.springframework.core.io.support.PathMatchingResourcePatternResolver.doFindPathMatchingFileResources(PathMatchingResourcePatternResolver.java:598) 位于org.springframework.core.io.support.PathMatchingResourcePatternResolver.findPathMatchingResources(PathMatchingResourcePatternResolver.java:419)
你能发布你的Spring和JPA配置吗?可能是重复的:这可能无法解决我的问题,因为我使用基于java的配置,而不是基于xml的配置,所以即使我为我的服务创建bean,Crudepository将如何注入,因为它是由Spring动态实现的。我们是否有任何工作的Spring JPA代码在OSGI中使用基于java的配置配置
@Configuration
@EnableTransactionManagement
@EnableJpaRepositories(basePackages="osgibundle:com.misys.fbp.frameworkInformation.repository")
@ComponentScan(basePackages="osgibundle:com.misys.fbp.frameworkInformation.dao")
public class PersistenceJPAConfig{
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
em.setDataSource(dataSource());
em.setPackagesToScan(new String[] { "osgibundle:com.misys.fbp.frameworkInformation.model"});
JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
em.setJpaVendorAdapter(vendorAdapter);
em.setJpaProperties(additionalProperties());
return em;
}