I have got a very similar setup working using no XML but have not tried combining the two approaches.
I tried it -- with static inner classes and with separate classes -- no successfully, still the same error. (If it's not an answer, so why not post it as comment? :) ) – php-coder Sep 15 at 3:53 Can you post your attempt at configuring the data sources in Java code?
– Alex Sep 15 at 10:46 See there: pastebin.ubuntu. Com/689938 I also tried use separated classes without luck. One point when it works -- when I define only one DataSource inside DbConfig class (without profiles and any classes).
– php-coder Sep 15 at 12:01 I don't think I ever managed to use @Value("${db. Username}") to specify the settings. I autowired the Environment into my Datasource class and then grabbed the properties from it.
Perhaps you could try it with hardcoded database properties to determine whether they are being correctly provided? – Alex Sep 15 at 12:55 I will try it tomorrow, but I've got error with test profile where these members not used. – php-coder Sep 15 at 14:24.
I've found cause of error, it occurs only when I manually define PersistenceAnnotationBeanPostProcessor: @Bean public PersistenceAnnotationBeanPostProcessor persistenceAnnotationBeanPostProcessor() { // enable injection of EntityManager to beans with @PersistenceContext annotation return new PersistenceAnnotationBeanPostProcessor(); } I'm sorry because I not posted full code in my question (because I supposed that this bean does not matter). When I removed this definition all works as expected. Also I found that in my case this bean already registered: Note: A default PersistenceAnnotationBeanPostProcessor will be registered by the "context:annotation-config" and "context:component-scan" XML tags.
Remove or turn off the default annotation configuration there if you intend to specify a custom PersistenceAnnotationBeanPostProcessor bean definition. (quote comment from org.springframework. Orm/src/main/java/org/springframework/orm/jpa/support/PersistenceAnnotationBeanPostProcessor.
Java).
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.