也许有人遇到过这样的问题。 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
我遇到了这个问题并通过删除以下行(位于 SpringBootApplication 类中)解决了它:
@ImportResource("classpath:web.xml")