1. root-context.xml 설정
1-1) util 설정
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.0.xsd">
<util:properties id="configProperties" location="classpath:config.properties"/>
2. config.properties 작성
#DB
mysql.username = SECKIM
#text
props.name = kangong
3. xml에서 사용법
<property name="username" value="#{configProperties['mysql.username']}"></property>
4. java에서 사용법
@Value("#{configProperties['props.name']}")
private String PROPS_NAME;
5. jsp에서 사용법
<spring:eval expression="@configProperties['mysql.username']"> </spring:eval>
'개발 > 개발환경설정' 카테고리의 다른 글
Spring message ResourceBundle 설정 (0) | 2020.08.11 |
---|---|
Spring property 암호화 (jasypt) (0) | 2020.08.11 |
Tiles 설정 (0) | 2020.08.10 |
Filter 설정 (0) | 2020.03.18 |
Interceptor 설정 (0) | 2020.03.17 |