spring boot ๋ vm ๊ฐ์ ํ ํ๋ฆฟ Resource๋ JAR์ ํฌํจํด์ผ ํ๊ธฐ ๋๋ฌธ์, resources/templates ๋ฑ์ ๋ฃ์ด์ ๊ด๋ฆฌํจ. ๊ทธ๋ฆฌ๊ณ ResourceLoader ๋ก class path ๊ธฐ์ค์ผ๋ก ๊ฐ์ ธ์ด,
Velocity ์๋์ค์ ์์ ๊ธฐ๋ณธ์ ์ผ๋ก ResourceLoader ๋ฅผ ClasspathResourceLoader ์ ์ฌ์ฉ.
// VelocityConfigurer.java @Override protected void postProcessVelocityEngine(VelocityEngine velocityEngine) { // ์๋ต ... velocityEngine.setProperty( SPRING_MACRO_RESOURCE_LOADER_CLASS, ClasspathResourceLoader.class.getName()); // ์๋ต ... }
Velomacro ๋ autoload ์ต์ ์ ์ฃผ๋ฉด, ํ์ผ์ด ์์ ๋ ๊ฒฝ์ฐ ์๋ฒ ์ฌ์์ ์์ด ๋งคํฌ๋ก๋ฅผ ๋ค์ ์ฝ์ด์ฃผ๋๋ฐ, ๋ฌธ์ ๋ ClasspathResourceLoader ๋ ๋ฆฌ์์ค๊ฐ ๋ณ๊ฒฝ์ด ์๋๋ค๊ณ ๊ฐ์ฃผ๋์ด ์์.
// ClasspathResourceLoader.java /** * @see org.apache.velocity.runtime.resource.loader.ResourceLoader#isSourceModified(org.apache.velocity.runtime.resource.Resource) */ public boolean isSourceModified(Resource resource) { return false; } /** * @see org.apache.velocity.runtime.resource.loader.ResourceLoader#getLastModified(org.apache.velocity.runtime.resource.Resource) */ public long getLastModified(Resource resource) { return 0; }
์ฆ, ์คํ๋ง ๋ถํธ์์ autoload ์ต์ ์ด ๋จน์ง ์์.;;













