And*_*dre 4 xml spring jasper-reports jasperserver
我有一个application.xml文件(directory = WEB-INF/application.xml)
我有一个jasperserver.properties文件(directory = WEB-INF/internal/jasperserver.properties)
这是在jasperserver.properties文件中
SERVICE_URL=http://b-reptest-lnx.nwu.ac.za:8026/jasperserver-pro/j_spring_cas_security
Run Code Online (Sandbox Code Playgroud)
我想从application.xml文件中读取"SERVICE_URL"属性
我该怎么做呢 ?
PropertyPlaceholderConfigurer在application.xml中使用.
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location">
<value>classpath:path/to/jasperserver.properties</value>
</property>
</bean>
Run Code Online (Sandbox Code Playgroud)
加载属性文件.然后在application.xml中使用$ {SERVICE_URL}来替换值:
<bean class="your class">
<property name="serviceURL"><value>${SERVICE_URL}</value></property>
</bean>
Run Code Online (Sandbox Code Playgroud)