I need to read my db to load a custom setting inside my Spring @Configuration class.
I have something like:
@Configuration
public MyConfigClass implements ApplicationContextAware{
@Bean(initMethod = "start", destroyMethod = "stop")
public ServerSession serverSession() throws Exception {
ServerSession serverSession = new ServerSession(urlGateway, useSsl, hostGateway, portGateway);
return serverSession;
}
I should read parameters from DB instead from property file. I know that I can't @Inject my repository directly into this class, but there is a trick or something that permit me to do this or at least make a query on db?
I'm using Hibernate + Spring + Spring Data.