Merge branch '2.0.x'
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 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.
|
||||
@@ -22,6 +22,8 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication.Type;
|
||||
import org.springframework.boot.autoconfigure.web.ServerProperties;
|
||||
import org.springframework.boot.autoconfigure.web.servlet.DispatcherServletPath;
|
||||
import org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.servlet.WebMvcProperties;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
@@ -48,7 +50,7 @@ import org.springframework.web.servlet.DispatcherServlet;
|
||||
@Configuration
|
||||
@ConditionalOnWebApplication(type = Type.SERVLET)
|
||||
@AutoConfigureAfter(WebMvcAutoConfiguration.class)
|
||||
@EnableConfigurationProperties(WebMvcProperties.class)
|
||||
@EnableConfigurationProperties({ ServerProperties.class, WebMvcProperties.class })
|
||||
public class MockMvcAutoConfiguration {
|
||||
|
||||
private final WebApplicationContext context;
|
||||
@@ -61,6 +63,12 @@ public class MockMvcAutoConfiguration {
|
||||
this.webMvcProperties = webMvcProperties;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public DispatcherServletPath dispatcherServletPath() {
|
||||
return () -> this.webMvcProperties.getServlet().getPath();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(MockMvcBuilder.class)
|
||||
public DefaultMockMvcBuilder mockMvcBuilder(
|
||||
|
||||
Reference in New Issue
Block a user