등록 정보 가져오기
3842 단어 properties
1 import java.io.File;
2 import java.io.FileInputStream;
3 import java.io.IOException;
4 import java.io.InputStream;
5 import java.util.Properties;
6
7 public class PropertiesUtil {
8
9 private Properties appProperties = new Properties();
10
11 /**
12 *
13 */
14 public void getAppProperties(String path) throws IOException {
15 InputStream in = new FileInputStream( new File(path));
16 appProperties.load(in);
17 in.close();
18 }
19
20 /**
21 *
22 * @param strFieldName - the field name
23 * @return strPro the field content
24 */
25 public String getSpecialProperty(String strFieldName) throws IOException {
26 String strProperty = strFieldName;
27 String strPro = appProperties.getProperty(strProperty);
28 return strPro != null ? strPro.trim() : strPro;
29 }
30
31 }
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Spring에서 속성 파일properties 읽기 및 사용 설명Spring에서 속성 파일properties 읽기 및 사용 설명 실제 프로젝트에서는 일반적으로 설정 가능한 맞춤형 정보를 속성 파일(예를 들어 데이터베이스 연결 정보, 메일 발송 설정 정보 등)에 넣으면 통일된 설정...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.