我需要读取我的数据库以加载Spring @Configuration类中的自定义设置。将Spring库存入Spring @Configuration类
我有类似:
@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;
}
我应该从数据库而不是从属性文件中读取参数。我知道我不能@直接将我的存储库注入到这个类中,但是有一个技巧或某些东西可以让我这样做,或者至少可以在db上进行查询?
我正在使用Hibernate + Spring + Spring Data。
就像一个魅力。谢谢 – drenda
不客气;-) –