Announcement Announcement Module
No announcement yet.
@Value does not work when PersistenceAnnotationBeanPostProcessor bean is defined Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • @Value does not work when PersistenceAnnotationBeanPostProcessor bean is defined

    I am working on Spring 3.0.0.RELEASE version and trying to understand the new concepts of Spring.

    In order to understand the transaction annotations (@PersistentUnit, @PersistentContext etc), I referred Spring documentation. The documentation advised me that I need to have a PersistenceAnnotationBeanPostProcessor defined as bean in my Spring configuration. (which I now know is not true.

    Anyways, I did introduce a PersistenceAnnotationBeanPostProcessor bean in my config and suddenly my @Value annotations stopped working. It took me quite a while to figure out that PersistenceAnnotationBeanPostProcessor was the culprit. As soon as I commented it, everything started working normally.

    Here is my Spring configuration:

    I am reading jdbc configurations from a properties file present on my classpath:

    private @Value("#{jdbcProperties['jdbc.driver']}") String jdbcDriver;
        private @Value("#{jdbcProperties['jdbc.url']}") String url;
        private @Value("#{jdbcProperties['jdbc.username']}") String username;
        private @Value("#{jdbcProperties['jdbc.password']}") String password;
    As soon as I define the following, @Value annotations stop working :

        public @Bean PersistenceAnnotationBeanPostProcessor beanPostProcessor(){
            PersistenceAnnotationBeanPostProcessor processor = new PersistenceAnnotationBeanPostProcessor();
            return processor;
    Looks like this is a bug. If it is, can some one confirm it and tell me where I can report this bug to.