Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add getter for RequestMappingInfo builder config #27723

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,17 @@ public List<String> getFileExtensions() {
return this.config.getFileExtensions();
}

/**
* Get the configuration to build {@link RequestMappingInfo}
* instances. This is useful for programmatic registration of
* additional mappings following the same configuration as {@link
* #createRequestMappingInfo(RequestMapping, RequestCondition)}.
*
* @return builder configuration to be supplied into {@link RequestMappingInfo.Builder#options}.
*/
public RequestMappingInfo.BuilderConfiguration getRequestMappingInfoBuilderConfiguration() {
return this.config;
}

/**
* {@inheritDoc}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,17 @@ static Stream<Arguments> pathPatternsArguments() {
return Stream.of(Arguments.of(mapping1, wac1), Arguments.of(mapping2, wac2));
}

@Test
void getRequestMappingInfoBuilderConfiguration() {
RequestMappingHandlerMapping handlerMapping = new RequestMappingHandlerMapping();
handlerMapping.setApplicationContext(new StaticWebApplicationContext());

RequestMappingInfo.BuilderConfiguration beforeAfterPropertiesSet = handlerMapping.getRequestMappingInfoBuilderConfiguration();
assertThat(beforeAfterPropertiesSet).isNotNull();
handlerMapping.afterPropertiesSet();
RequestMappingInfo.BuilderConfiguration afterPropertiesSet = handlerMapping.getRequestMappingInfoBuilderConfiguration();
assertThat(afterPropertiesSet).isNotNull().isNotSameAs(beforeAfterPropertiesSet);
}

@Test
@SuppressWarnings("deprecation")
Expand Down