如何将Spring管理的SessionCustomizer放入EclipseLink配置中
我在一个春季项目中与eclipselink合作。配置的一个必要部分是SessionCustomizer,它配置我的id生成器(Snowflake by twitter) 是否可以使用spring处理此自定义程序的创建,以便我可以使用依赖项注入和属性占位符? 我为定制者找到的唯一示例总是在持久性xml中配置类 以下是我目前的配置:如何将Spring管理的SessionCustomizer放入EclipseLink配置中,spring,eclipselink,spring-orm,Spring,Eclipselink,Spring Orm,我在一个春季项目中与eclipselink合作。配置的一个必要部分是SessionCustomizer,它配置我的id生成器(Snowflake by twitter) 是否可以使用spring处理此自定义程序的创建,以便我可以使用依赖项注入和属性占位符? 我为定制者找到的唯一示例总是在持久性xml中配置类 以下是我目前的配置: <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainer
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceUnitName" value="platform.auth-service" />
<property name="jpaDialect" ref="jpaDialect" />
<property name="jpaVendorAdapter" ref="jpaVendorAdapter" />
<property name="jpaPropertyMap" ref="jPAPropertyProviderMap" />
</bean>
<bean id="jpaVendorAdapter" class="org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter">
<property name="generateDdl" value="${database.generateTables}" />
<property name="databasePlatform" value="${database.platform}" />
</bean>
<bean id="entityManager" class="org.springframework.orm.jpa.support.SharedEntityManagerBean">
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>
<bean id="jpaDialect" class="org.springframework.orm.jpa.vendor.EclipseLinkJpaDialect" />
虽然spring aop(AspectJ集成)中的
@可配置注释是一个解决方案,但我决定使用静态SequenceHolder
类解决我的问题,在该类中,我使用SequenceInstaller
bean存储序列
最后,SessionCustomizer
在persistencecontextfactory中安装存储的序列
我必须在工厂和安装程序之间配置一个依赖项,因为spring可能在安装程序之前处理工厂