java - Referencing Property file in Servlet Context -
newbies question:
i have in context xml
<bean class="org.springframework.beans.factory.config.propertyplaceholderconfigurer"> <property name="locations"> <value>classpath:my_portal.properties</value> </property> </bean>
i have my_portal.properties file part of intellij project (in /conf directory), seems when run/debug war_exploded artifact not provide tomcat ability access file. how can expose file tomcat can access it's properties inside xml context files?
the classpath:
prefix means: resource in classpath. classpath of webapp composed of web-inf/classes directory, , of jars unders web-inf/lib.
so put file in source folder, , intellij "compile" copying target folder, along compiled classes. or change intellij project configuration make copy file web-inf/classes in generated (exploded) war.
if you're using maven conventional layout, should under src/main/resources
.
Comments
Post a Comment