Polish
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2021 the original author or authors.
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -125,26 +125,27 @@ class MvcWebEndpointIntegrationTests
|
||||
private RequestMatchResult getMatchResult(String servletPath, boolean isPatternParser) {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
request.setServletPath(servletPath);
|
||||
AnnotationConfigServletWebServerApplicationContext context = new AnnotationConfigServletWebServerApplicationContext();
|
||||
if (isPatternParser) {
|
||||
context.register(WebMvcConfiguration.class);
|
||||
try (AnnotationConfigServletWebServerApplicationContext context = new AnnotationConfigServletWebServerApplicationContext()) {
|
||||
if (isPatternParser) {
|
||||
context.register(WebMvcConfiguration.class);
|
||||
}
|
||||
else {
|
||||
context.register(PathMatcherWebMvcConfiguration.class);
|
||||
}
|
||||
context.register(TestEndpointConfiguration.class);
|
||||
context.refresh();
|
||||
WebMvcEndpointHandlerMapping bean = context.getBean(WebMvcEndpointHandlerMapping.class);
|
||||
try {
|
||||
// Setup request attributes
|
||||
ServletRequestPathUtils.parseAndCache(request);
|
||||
// Trigger initLookupPath
|
||||
bean.getHandler(request);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
return bean.match(request, "/spring");
|
||||
}
|
||||
else {
|
||||
context.register(PathMatcherWebMvcConfiguration.class);
|
||||
}
|
||||
context.register(TestEndpointConfiguration.class);
|
||||
context.refresh();
|
||||
WebMvcEndpointHandlerMapping bean = context.getBean(WebMvcEndpointHandlerMapping.class);
|
||||
try {
|
||||
// Setup request attributes
|
||||
ServletRequestPathUtils.parseAndCache(request);
|
||||
// Trigger initLookupPath
|
||||
bean.getHandler(request);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
return bean.match(request, "/spring");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user