Results 1 to 2 of 2

Thread: Using PersistenceAnnotationBeanPostProcessor in java-based config

  1. #1
    Join Date
    Sep 2007
    Posts
    1

    Default 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. #2

    Default

    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).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •