spring mvc报错:No more pattern data allowed after {*...} or ** pattern element

本文介绍了Spring MVC升级后关于路径通配的错误,导致的`APPLICATION FAILED TO START`问题。解决办法是调整路径模式为`*/*.css`,并说明了背景变化原因。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

具体报错:

***************************
APPLICATION FAILED TO START
***************************

Description:

Invalid mapping pattern detected: /**/*.css
^
No more pattern data allowed after {*...} or ** pattern element

Action:

Fix this pattern in your application or switch to the legacy parser implementation with `spring.mvc.pathpattern.matching-strategy=ant_path_matcher`.


Process finished with exit code 0

原因:

错误是路径通配问题,查找发现是spring升级到5.3之后路径通配发生了变化,官方给出的解释是“In Spring MVC, the path was previously analyzed by AntPathMatcher, but it was changed to use PathPatternParser introduced in WebFlux from Spring 5.3.0.”。

解决:

具体解决是把/**/*.css 改为 /*/*.css,项目中可能涉及多个文件,都要改。

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值