Could not open ServletContext resource

后端 未结 8 834
情歌与酒
情歌与酒 2020-12-05 02:16

This is quite similar question to one older but the solution did not work for me.

I have a WAR package.

In web.xml



        
相关标签:
8条回答
  • 2020-12-05 03:04

    try with this code...

     <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
             <property name="ignoreUnresolvablePlaceholders" value="true"/>
                 <property name="locations">
                  <list>                        
                        <value>/social.properties</value>               
                  </list>
             </property>         
            </bean>
    
    0 讨论(0)
  • 2020-12-05 03:06

    I think currently the application-context.xml file is into src/main/resources AND the social.properties file is into src/main/java... so when you package (mvn package) or when you run tomcat (mvn tomcat:run) your social.properties disappeared (I know you said when you checked into the .war the files are here... but your exception says the opposite).

    The solution is simply to put all your configuration files (application-context.xml and social.properties) into src/main/resources to follow the maven standard structure.

    0 讨论(0)
提交回复
热议问题