Spring java-quartz 调度应用
我想加载 .property 文件动态传递的抛出程序参数而不是 context:property-placeholder 在 spring 上下文中,我怎样才能完成这个任务,任何帮助表示赞赏......
我正在从主 java 文件手动加载和刷新 spring 上下文,如以下代码所示。
SpringUtil_1.loadSpringConfig();
rootContext = new ClassPathXmlApplicationContext();
rootContext.setConfigLocation("abc-configuration.xml");
rootContext.refresh();
在弹簧配置中,我有如下的上下文属性占位符,我想从代码中获取。
<context:property-placeholder location="classpath:lnRuntime.properties"/>
我在spring上下文中使用占位符,使用spring EL的java文件如下
<bean id="dataSource"
class="org.springframework.jdbc.datasource.SingleConnectionDataSource">
<property name="driverClassName" value="net.sourceforge.jtds.jdbcx.JtdsDataSource"/>
<property name="url" value="${dataSource.url}"/>
</bean>
在java中我访问如下
private @Value("${dz.host}") String dzHost;