2016-05-25 10 views
0

私はspring mvcアプリケーションを作成しましたが、D:\ propertiesfile.propertiesに外部プロパティファイルを持っていましたので、servlet-context.xmlでプロパティファイルを設定する方法を知りたいですSpring MVCアプリケーションの外部プロパティファイルの設定

<beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> 
<beans:property name="prefix" value="/WEB-INF/views/" /> 
<beans:property name="suffix" value=".jsp" /> 
</beans:bean> 
<context:property-placeholder location="file:D:\propertiesfile.properties> 
<context:component-scan base-package="com.example.properties" /> 

しかし、動作しません。私を案内してください

答えて

0

可能であれば、スプリングブートを使用することをお勧めします。春の起動時にはコンパイル済みのjarファイルの外側にapplication.propertiesを置くことができます。また、自動設定も付属しているので、基本的に "xml"と多くの設定オーバーヘッドが "死"します。そして、あなたは非常に簡単に必要な場合、あなたはここを見ておくことをお勧めします:spring boot external configuration

関連する問題