类路径资源【WEB-INF/web.xml】不存在,无法打开

问题描述 投票:0回答:1

也许有人遇到过这样的问题。 web.xml 文件在 WEB-INF/web.xml 路径上,但错误提示并非如此。

2022-11-16 17:40:56.120  WARN 3272 --- [main] s.c.a.AnnotationConfigApplicationContext : 
Exception encountered during context initialization - cancelling refresh
attempt: org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'securityConfiguration': Unsatisfied
dependency expressed through field 'webXmlRolesParser'; nested exception
is org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'webXmlRolesParser' defined in class path resource
[by/belinvest/panel/admin/config/SecurityConfiguration.class]: Invocation
of init method failed; nested exception is java.io.FileNotFoundException:
class path resource [WEB-INF/web.xml] cannot be opened because it does not exist
java spring spring-boot web.xml
1个回答
0
投票

我遇到了这个问题并通过删除以下行(位于 SpringBootApplication 类中)解决了它:

@ImportResource("classpath:web.xml")

© www.soinside.com 2019 - 2024. All rights reserved.