JAVA에서 Properties 파일 읽을 경우
@Service("applicationConfig")
public class ApplicationConfig
{
//util:properties 변수 읽을때
@Value("#{commonapp['app.CLASS_DEBUG']}")
String classDeBug;
//properties-placeholder 변수 읽을때
@Value("${config.application.title}")
String configApplicationTitle;
//환경변수 읽을때
@Value("#{systemProperties['os.name']}")
String osName;
}
Properties 파일 UTF-8 형식으로 읽기(한글 사용시)
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations" value="classpath:config.properties"/>
<property name="fileEncoding" value="UTF-8"/>
</bean>
댓글 없음:
댓글 쓰기