首页 > 代码库 > class path resource [spring/ApplicationContext-springmvc.xml] cannot be opened because it does not exist

class path resource [spring/ApplicationContext-springmvc.xml] cannot be opened because it does not exist

配置如下:

<init-param>
   <param-name>contextConfigLocation</param-name>
   <param-value>classpath:spring/ApplicationContext-springmvc.xml</param-value>
  </init-param>

原因是:IDE认为spring文件夹是在source下的,所以找不到

解决方案:

在classpath后面加个*

如下:

<init-param>
   <param-name>contextConfigLocation</param-name>
   <param-value>classpath*:spring/ApplicationContext-springmvc.xml</param-value>
  </init-param>

class path resource [spring/ApplicationContext-springmvc.xml] cannot be opened because it does not exist