Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
94e9c941
Commit
94e9c941
authored
Apr 04, 2017
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '1.4.x' into 1.5.x
parents
4d71bfbf
b280e309
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
3 deletions
+14
-3
WebMvcAutoConfiguration.java
...ework/boot/autoconfigure/web/WebMvcAutoConfiguration.java
+5
-3
WebMvcAutoConfigurationTests.java
.../boot/autoconfigure/web/WebMvcAutoConfigurationTests.java
+9
-0
No files found.
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration.java
View file @
94e9c941
...
...
@@ -300,7 +300,8 @@ public class WebMvcAutoConfiguration {
@Bean
public
WelcomePageHandlerMapping
welcomePageHandlerMapping
(
ResourceProperties
resourceProperties
)
{
return
new
WelcomePageHandlerMapping
(
resourceProperties
.
getWelcomePage
());
return
new
WelcomePageHandlerMapping
(
resourceProperties
.
getWelcomePage
(),
this
.
mvcProperties
.
getStaticPathPattern
());
}
private
void
customizeResourceHandlerRegistration
(
...
...
@@ -520,8 +521,9 @@ public class WebMvcAutoConfiguration {
private
static
final
Log
logger
=
LogFactory
.
getLog
(
WelcomePageHandlerMapping
.
class
);
private
WelcomePageHandlerMapping
(
Resource
welcomePage
)
{
if
(
welcomePage
!=
null
)
{
private
WelcomePageHandlerMapping
(
Resource
welcomePage
,
String
staticPathPattern
)
{
if
(
welcomePage
!=
null
&&
"/**"
.
equals
(
staticPathPattern
))
{
logger
.
info
(
"Adding welcome page: "
+
welcomePage
);
ParameterizableViewController
controller
=
new
ParameterizableViewController
();
controller
.
setViewName
(
"forward:index.html"
);
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfigurationTests.java
View file @
94e9c941
...
...
@@ -569,6 +569,15 @@ public class WebMvcAutoConfigurationTests {
.
andExpect
(
status
().
isNotFound
());
}
@Test
public
void
welcomePageRootHandlerIsNotRegisteredWhenStaticPathPatternIsNotSlashStarStar
()
{
load
(
"spring.resources.static-locations:classpath:/welcome-page/"
,
"spring.mvc.static-path-pattern:/foo/**"
);
WelcomePageHandlerMapping
welcomePageHandlerMapping
=
this
.
context
.
getBean
(
WelcomePageHandlerMapping
.
class
);
assertThat
(
welcomePageHandlerMapping
.
getRootHandler
()).
isNull
();
}
@Test
public
void
welcomePageMappingHandlesRequestsThatAcceptTextHtml
()
throws
Exception
{
load
(
"spring.resources.static-locations:classpath:/welcome-page/"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment