①
<bean class="org.springframework.bean.factory.config.PropertyPlaceholderConfigure"
? ?p:location="classpath:com/xx/x/jdbc.properties"
? ?p:fileEncoding="utf-8"/>
②
<context:property-placeholder location="classpath:com/xx/x/jdbc.properties"/>
如果需要配置編碼不可以直接設置file-encoding="uft-8", 會報錯!!!
正確配置如下:
<bean id="utf8" class="java.lang.String">
? ?<constructor-arg value="utf-8"></constructor>
</bean>
<context:property-placeholder location="classpath:com/xx/x/jdbc.properties"
? ?file-encoding="utf8"/>
**在屬性文件中如果屬性值 太長 , ?可以在行后添加"\"分行
例如:在jdbc.properties中
password=a123456789qewrryurtyi\
sdfsnsgsvgertneesrteshsdtertsdgae