2011-08-18 4 views
2

私はapplicationContext.xmlにフリーメーカBeanを定義していますが、このBeanにはテンプレートディレクトリのパスが必要です。 それがために使用:誰でもしてくださいapplicationContext.xmlのスプリングパス

<bean id="freemarkerConfig" class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer"> 
    <property name="templateLoaderPath" value="/template/email/"/> 
</bean> 

ことができます。

src/main/webapp/template/

しかし、私は今の下に私のテンプレートを保存する:

src/main/resources/template/

それがどのように見えるのに使用新しいパスを正しく定義するのに役立ちますか?

+0

classpath:prefixは役に立ちますか? – kan

+0

はいそうですね! :) お返事をありがとうございます! – user829237

答えて

1

適切な回答として回答するので、質問を閉じることができます。

クラスパスにあるリソースを参照するには、 "classpath:"という接頭辞を使用する必要があります。

<bean id="freemarkerConfig" class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer"> 
    <property name="templateLoaderPath" value="classpath:/template/email/"/> 
</bean> 
関連する問題