Spring MVC - @PropertySource ์ฌ์ฉ ์ค FileNotFoundException: Could not open ServletContext resource ์๋ฌ Spring MVC - @PropertySource ์ฌ์ฉ ์ค FileNotFoundException: Could not open ServletContext resource ์๋ฌ โ๏ธ Spring Web MVC 5.2.6.RELEASE ์คํ๋ง ์น MVC ํ๋ก์ ํธ์์ ํ๋กํผํฐ๋ฅผ ์ฌ์ฉํ๋ค๊ฐ ๋ค์๊ณผ ๊ฐ์ ์๋ฌ๊ฐ ๋ฐ์ํ์๋ค. java.io.FileNotFoundException: Could not open ServletContext resource [/properties/data1.properties] ํ๋ก์ ํธ์ ํ๋กํผํฐ ํ์ผ ์์น๋ src/main/resources/properties/data1.properties ๋ฉ์ด๋ธ ํ๋ก์ ํธ์ด๊ธฐ ๋๋ฌธ์ ๋น๋ํ๋ฉด resources ๋ด์ ํ์ผ๋ค์ด classpath๋ก ๋ณต์ฌ๋๋ค... 2020. 5. 6. JAVA ์น ํ๋ก์ ํธ์์ Properties ํ์ผ ํ์ฉํ๊ธฐ JAVA ์น ํ๋ก์ ํธ์์ Properties ํ์ผ ํ์ฉํ๊ธฐ ์น ์ดํ๋ฆฌ์ผ์ด์ ์ด ์์ํ์๋ง์ ๊ฐ์ ธ์์ผํ๋ ์ ๋ณด์ ๊ฐ์ ๊ฒ๋ค์ ํ๋กํผํฐ ํ์ผ์ ์์ฑํด์ ๊ด๋ฆฌํ ์ ์๋ค. ์น ํ๋ก์ ํธ์์ ํ๋กํผํฐ ํ์ผ์ ์์ฑํด์ ๊บผ๋ด ์ฌ์ฉํ๋ ๋ฐฉ๋ฒ์ ๋ํด ์์๋ณด์. ํ๋กํผํฐ ํ์ผ ์์ฑํ๊ธฐ ํ๋กํผํฐ ํ์ผ์ ํ ๋ผ์ธ์ key=value ํ์์ผ๋ก ์์ฑํ๊ณ .properties ํ์ฅ์๋ฅผ ๋ถ์ฌ ์ ์ฅํ๋ค. ์๋ฅผ ๋ค์ด ๋ค์๊ณผ ๊ฐ์ด ์์ฑํ ์ ์๋ค. ํ๋กํผํฐ ํ์ผ ๋ก๋ฉ ๋ฐ ๋ด์ฉ ๊ฐ์ ธ์ค๊ธฐ(์ฝ๊ธฐ) java.util.Properties ํด๋์ค๋ฅผ ์ฌ์ฉํด์ ํ๋กํผํฐ ํ์ผ์ ๋ค๋ฃฐ ์ ์๋ค. Properties๋ key=value ํ์์ ํ ์คํธ ํ์ผ์ ๋ค๋ฃฐ ๋ ์ฌ์ฉํ๋ ํด๋์ค์ด๋ค. ์๋์ ๊ฐ์ด ํ๋กํผํฐ ํ์ผ์ ๋ก๋ํ์ฌ ๋ด์ฉ์ ๊ฐ์ ธ์ฌ ์ ์๋ค. 1 2 3.. 2020. 2. 20. ์ด์ 1 ๋ค์