springソースコード解析@PathVarable詳細


springソースコードの分析を通して、@PathVarableは慎重に使います.確かにあなたのURLを綺麗にしますが、それは大きな性能を犠牲にしました.springは先にmappingの中で精確にマッチングして、整合して歩き始めません@PathVarableのはっきりしないマッチングを歩きます.
詳細はspringソースコードAbstracthandler MethodMapping 289行を参照してください.
 private void addMatchingMappings(Collection<T> mappings, List<Match> matches, HttpServletRequest request) {
for (T mapping : mappings) {
T match = getMatchingMapping(mapping, request);
if (match != null) {
matches.add(new Match(match, handlerMethods.get(mapping)));
}
}
}