我需要讀取我的數據庫以加載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
不客氣;-) –