Hello,
I would like to implements a custom PropertyPlaceholderConfigurer to load my properties from a database.
So I just add a Bean like this :
The problem is that the entitymanager is null !
The configuration is the same for my DAO's and it works!
I've just noticed that if I remove "extends PropertyPlaceholderConfigurer", the entitymanager is well injected.
Can someone tell me why it doesn't work in a PropertyPlaceholderConfigurer?
Thank you.
Stéphane
I would like to implements a custom PropertyPlaceholderConfigurer to load my properties from a database.
So I just add a Bean like this :
Code:
@Repository
@Transactional
public class DatabasePropertyPlaceholderConfigurerImpl extends PropertyPlaceholderConfigurer {
@PersistenceContext
private EntityManager em;
public DatabasePropertyPlaceholderConfigurerImpl() {
super();
setPlaceholderPrefix("${");
}
@Override
protected void loadProperties(final Properties props) throws IOException {
// DO STUFF HERE WITH ENTITYMANAGER TO LOAD THE PROPS
}
}
The configuration is the same for my DAO's and it works!
I've just noticed that if I remove "extends PropertyPlaceholderConfigurer", the entitymanager is well injected.
Can someone tell me why it doesn't work in a PropertyPlaceholderConfigurer?
Thank you.
Stéphane