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
923f286a
Commit
923f286a
authored
Sep 27, 2013
by
Dave Syer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add spring.view.{prefix,suffix} properties
Fixes #62
parent
c661a74c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
12 deletions
+12
-12
WebMvcAutoConfiguration.java
...ework/boot/autoconfigure/web/WebMvcAutoConfiguration.java
+9
-1
SampleWebJspApplication.java
...ingframework/boot/sample/jsp/SampleWebJspApplication.java
+1
-11
application.properties
...-sample-web-jsp/src/main/resources/application.properties
+2
-0
No files found.
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration.java
View file @
923f286a
...
...
@@ -28,6 +28,7 @@ import org.apache.commons.logging.LogFactory;
import
org.springframework.beans.factory.BeanFactory
;
import
org.springframework.beans.factory.ListableBeanFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.autoconfigure.AutoConfigureAfter
;
import
org.springframework.boot.autoconfigure.EnableAutoConfiguration
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnBean
;
...
...
@@ -110,6 +111,12 @@ public class WebMvcAutoConfiguration {
private
static
Log
logger
=
LogFactory
.
getLog
(
WebMvcConfigurerAdapter
.
class
);
@Value
(
"${spring.view.prefix:}"
)
private
String
prefix
=
""
;
@Value
(
"${spring.view.suffix:}"
)
private
String
suffix
=
""
;
@Autowired
private
ListableBeanFactory
beanFactory
;
...
...
@@ -117,10 +124,11 @@ public class WebMvcAutoConfiguration {
private
ResourceLoader
resourceLoader
;
@Bean
@ConditionalOnBean
(
View
.
class
)
@ConditionalOnMissingBean
(
InternalResourceViewResolver
.
class
)
public
InternalResourceViewResolver
defaultViewResolver
()
{
InternalResourceViewResolver
resolver
=
new
InternalResourceViewResolver
();
resolver
.
setPrefix
(
this
.
prefix
);
resolver
.
setSuffix
(
this
.
suffix
);
return
resolver
;
}
...
...
spring-boot-samples/spring-boot-sample-web-jsp/src/main/java/org/springframework/boot/sample/jsp/SampleWebJspApplication.java
View file @
923f286a
...
...
@@ -18,24 +18,14 @@ package org.springframework.boot.sample.jsp;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.EnableAutoConfiguration
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.servlet.view.InternalResourceViewResolver
;
@Configuration
@EnableAutoConfiguration
@ComponentScan
public
class
SampleWebJspApplication
{
@Bean
public
InternalResourceViewResolver
defaultViewResolver
()
{
InternalResourceViewResolver
resolver
=
new
InternalResourceViewResolver
();
resolver
.
setPrefix
(
"/WEB-INF/jsp/"
);
resolver
.
setSuffix
(
".jsp"
);
return
resolver
;
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
SpringApplication
.
run
(
SampleWebJspApplication
.
class
,
args
);
}
...
...
spring-boot-samples/spring-boot-sample-web-jsp/src/main/resources/application.properties
0 → 100644
View file @
923f286a
spring.view.prefix
:
/WEB-INF/jsp/
spring.view.suffix
:
.jsp
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