본문 바로가기
develop/spring

spring property 사용

by hybr1d 2016. 3. 25.

context-common.xml (전자정부프레임워크 빈등록 파일이다)


<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xmlns:context="http://www.springframework.org/schema/context"

xmlns:util="http://www.springframework.org/schema/util"

xsi:schemaLocation=" http://www.springframework.org/schema/util 

        http://www.springframework.org/schema/util/spring-util-3.2.xsd 

        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd

        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd">




- 프로퍼티 등록

<util:properties id="fileProp" location="classpath:/egovframework/properties/file.properties"/>



-file.properties

file.url=D:/hybr1d/workspace/src/main/webapp/upload/ckImages



-Servlet 에서 사용

@Value("#{fileProp['file.url']}")

private String FILE_URL;


FILE_URL 변수에 값이 선언된다.

'develop > spring' 카테고리의 다른 글

spring restful 관련 web.xml, servlet.xml 파일 설정  (0) 2017.06.21
프로젝트 설정 - web.xml  (0) 2016.03.25