有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!


共 (1) 个答案

  1. # 1 楼答案

    引入PathPattern的原因将在this post on spring.io中详细解释。以下是这篇文章的几段摘录:

    In Spring applications AntPathMatcher is used to identify classpath, file system, remote, and other resources in Spring configuration. It has also been used in Spring MVC to match URL paths. Over time the use of patterns in web applications grew in number and syntax with AntPathMatcher evolving to meet those needs but some pain points remain without a solution.

    The introduction of Spring WebFlux in Spring Framework 5.0 was a good opportunity to re-think all this and to create an alternative.

    PathPattern

    Patterns are parsed on startup and re-used at runtime for efficient URL matching. How much more efficient? It’s hard to give numbers without a concrete use case but our jmh benchmark shows 6-8 times the throughput and 30-40% reduction in allocation rate.

    PathPattern is compatible with AntPathMatcher syntax except couple cases (listed in the post.)