java中載入properties檔案
阿新 • • 發佈:2018-12-24
<!-- 載入配置檔案properties 方法1 --> <context:property-placeholder location="classpath:application-config.properties" ignore-unresolvable="true" /> <!-- 載入配置檔案properties 利用spring 方法2 --> <bean id="configProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean"> <property name="locations"> <list> <value>classpath:hibernate-db.properties</value> </list> </property> </bean> <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PreferencesPlaceholderConfigurer"> <property name="properties" ref="configProperties" /> </bean>