Announcement Announcement Module
Collapse
No announcement yet.
Using PersistenceAnnotationBeanPostProcessor in java-based config Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using PersistenceAnnotationBeanPostProcessor in java-based config

    I've been working with @Configuration classes with mixed results. It seems like it should be possible to replace...

    Code:
    <bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor">
            <property name="defaultPersistenceUnitName" value="truth" />
    </bean>
    with...

    Code:
    @Bean
        public PersistenceAnnotationBeanPostProcessor persistenceAnnotationBeanPostProcessor() { 
        	PersistenceAnnotationBeanPostProcessor proc = new PersistenceAnnotationBeanPostProcessor();
        	proc.setDefaultPersistenceUnitName("my-unit");
        	return proc;
        }
    However, this seems cause existing BeanProstProcessors on the ApplicationContext to break. In my case I am using a PropertyPlaceholderConfigurer which stops working once the PersistenceAnnotationBeanPostProcessor is created. Am I missing something?

    Thanks

  • #2
    I know this is an old thread but I ran into this same issue (using Spring 3.1.2) and it took me a while to figure out what went wrong. Is PersistenceAnnotationBeanPostProcessor necessary? I seem to run fine without it (i.e. entitymanagers are being wired up).

    Comment

    Working...
    X