我正在尝试使其可选以连接到我的代码库中的JPA存储库。
我在pom中具有spring数据启动器依赖性,在数据源(实体管理器bean)上具有@ConditionalOnProperty。
但是当应用程序启动时,我得到了
org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'jpaAuditingHandler':
Cannot resolve reference to bean 'jpaMappingContext' while setting constructor argument;
nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'jpaMappingContext':
Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: At least one JPA metamodel must be present!
有什么办法可以抑制这种情况?
PS:我已禁用弹簧数据的自动配置
@EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class, DataSourceTransactionManagerAutoConfiguration.class, HibernateJpaAutoConfiguration.class})