第一步:application.properties配置文件中建立内容:
ios.test.appKey=824f1694e205e2973933482c
ios.test.masterSecret=206399b1ce5e75236bcf0490
第二步:配置applicationContext-commom.xml文件:
<bean id="configProperties" class="com.sf.egmas.isn.framework.SystemProperties">
<property name="locations">
<array>
<value>classpath:application.properties</value>
</array>
</property>
</bean>
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PreferencesPlaceholderConfigurer">
<property name="properties" ref="configProperties" />
</bean>
第三步:在java代码类读取配置文件的内容:
@Value("#{configProperties['jiguang.hmt.ios.appKey']}")
private String hmtIosAppKey;
@Value("#{configProperties['jiguang.hmt.ios.masterSecret']}")
private String hmtIosMasterSecret;