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
030f00c3
Commit
030f00c3
authored
Apr 30, 2014
by
Dave Syer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert actuator-ui sample to FreeMarker
See gh-679
parent
50190a4d
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
64 additions
and
31 deletions
+64
-31
FreeMarkerAutoConfiguration.java
...autoconfigure/freemarker/FreeMarkerAutoConfiguration.java
+5
-5
pom.xml
spring-boot-samples/spring-boot-sample-actuator-ui/pom.xml
+1
-1
error.ftl
...sample-actuator-ui/src/main/resources/templates/error.ftl
+32
-0
home.ftl
...-sample-actuator-ui/src/main/resources/templates/home.ftl
+26
-0
home.html
...sample-actuator-ui/src/main/resources/templates/home.html
+0
-25
No files found.
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfiguration.java
View file @
030f00c3
...
...
@@ -49,7 +49,6 @@ import org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver;
*/
@Configuration
@ConditionalOnClass
(
freemarker
.
template
.
Configuration
.
class
)
@ConditionalOnWebApplication
@AutoConfigureAfter
(
WebMvcAutoConfiguration
.
class
)
public
class
FreeMarkerAutoConfiguration
{
...
...
@@ -60,7 +59,7 @@ public class FreeMarkerAutoConfiguration {
public
static
final
String
DEFAULT_SUFFIX
=
".ftl"
;
@Configuration
public
static
class
Free
m
arkerConfigurerConfiguration
implements
EnvironmentAware
{
public
static
class
Free
M
arkerConfigurerConfiguration
implements
EnvironmentAware
{
@Autowired
private
final
ResourceLoader
resourceLoader
=
new
DefaultResourceLoader
();
...
...
@@ -105,14 +104,15 @@ public class FreeMarkerAutoConfiguration {
@Configuration
@ConditionalOnClass
(
Servlet
.
class
)
public
static
class
FreemarkerViewResolverConfiguration
implements
EnvironmentAware
{
@ConditionalOnWebApplication
public
static
class
FreeMarkerViewResolverConfiguration
implements
EnvironmentAware
{
private
RelaxedPropertyResolver
environment
;
@Override
public
void
setEnvironment
(
Environment
environment
)
{
this
.
environment
=
new
RelaxedPropertyResolver
(
environment
,
"spring.free
M
arker."
);
"spring.free
m
arker."
);
}
@Bean
...
...
@@ -135,7 +135,7 @@ public class FreeMarkerAutoConfiguration {
resolver
.
setAllowSessionOverride
(
this
.
environment
.
getProperty
(
"allowSessionOverride"
,
Boolean
.
class
,
false
));
resolver
.
setExposeSpringMacroHelpers
(
this
.
environment
.
getProperty
(
"exposeSpringMacroHelpers"
,
Boolean
.
class
,
fals
e
));
"exposeSpringMacroHelpers"
,
Boolean
.
class
,
tru
e
));
resolver
.
setRequestContextAttribute
(
this
.
environment
.
getProperty
(
"requestContextAttribute"
));
...
...
spring-boot-samples/spring-boot-sample-actuator-ui/pom.xml
View file @
030f00c3
...
...
@@ -25,7 +25,7 @@
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-
thymeleaf
</artifactId>
<artifactId>
spring-boot-starter-
freemarker
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
...
...
spring-boot-samples/spring-boot-sample-actuator-ui/src/main/resources/templates/error.
htm
l
→
spring-boot-samples/spring-boot-sample-actuator-ui/src/main/resources/templates/error.
ft
l
View file @
030f00c3
<
#
import
"/
spring
.
ftl
"
as
spring
/>
<!DOCTYPE html>
<html
xmlns:th=
"http://www.thymeleaf.org"
>
<html>
<head>
<title>
Error
</title>
<link
rel=
"stylesheet"
th:href=
"@{/css/bootstrap.min.css}"
href=
"../../css/bootstrap.min.css"
/>
<
#
assign
home
><
@
spring
.
url
relativeUrl=
"/"
/></
#
assign>
<
#
assign
bootstrap
><
@
spring
.
url
relativeUrl=
"/css/bootstrap.min.css"
/></
#
assign>
<link
rel=
"stylesheet"
href=
"${bootstrap}"
/>
</head>
<body>
<div
class=
"container"
>
<div
class=
"navbar"
>
<div
class=
"navbar-inner"
>
<a
class=
"brand"
href=
"http://www.thymeleaf.org"
>
Thymeleaf
-
<a
class=
"brand"
href=
"http://www.thymeleaf.org"
>
Freemarker
-
Plain
</a>
<ul
class=
"nav"
>
<li><a
th:href=
"@{/}"
href=
"home.html
"
>
Home
</a></li>
<li><a
href=
"${home}
"
>
Home
</a></li>
</ul>
</div>
</div>
<h1
th:text=
"${title}"
>
Title
</h1>
<div
id=
"created"
th:text=
"${#dates.format(timestamp)}"
>
July 11,
2012 2:17:16 PM CDT
</div>
<h1>
Error Page
</h1>
<div
id=
"created"
>
${timestamp?datetime}
</div>
<div>
There was an unexpected error (type=
<span
th:text=
"${error}"
>
Bad
</span>
, status=
<span
th:text=
"${status}"
>
500
</span>
).
There was an unexpected error (type=
${error}, status=${status}
).
</div>
<div
th:text=
"${message}"
>
Fake content
</div>
<div
>
${message}
</div>
<div>
Please contact the operator with the above information.
</div>
...
...
spring-boot-samples/spring-boot-sample-actuator-ui/src/main/resources/templates/home.ftl
0 → 100644
View file @
030f00c3
<
#
import
"/
spring
.
ftl
"
as
spring
/>
<!DOCTYPE html>
<html>
<head>
<title>
${title}
</title>
<
#
assign
home
><
@
spring
.
url
relativeUrl=
"/"
/></
#
assign>
<
#
assign
bootstrap
><
@
spring
.
url
relativeUrl=
"/css/bootstrap.min.css"
/></
#
assign>
<link
rel=
"stylesheet"
href=
"${bootstrap}"
/>
</head>
<body>
<div
class=
"container"
>
<div
class=
"navbar"
>
<div
class=
"navbar-inner"
>
<a
class=
"brand"
href=
"http://www.thymeleaf.org"
>
Freemarker -
Plain
</a>
<ul
class=
"nav"
>
<li><a
href=
"${home}"
>
Home
</a></li>
</ul>
</div>
</div>
<h1>
${title}
</h1>
<div>
${message}
</div>
<div
id=
"created"
>
${date?datetime}
</div>
</div>
</body>
</html>
spring-boot-samples/spring-boot-sample-actuator-ui/src/main/resources/templates/home.html
deleted
100644 → 0
View file @
50190a4d
<!DOCTYPE html>
<html
xmlns:th=
"http://www.thymeleaf.org"
>
<head>
<title
th:text=
"${title}"
>
Title
</title>
<link
rel=
"stylesheet"
th:href=
"@{/css/bootstrap.min.css}"
href=
"../../css/bootstrap.min.css"
/>
</head>
<body>
<div
class=
"container"
>
<div
class=
"navbar"
>
<div
class=
"navbar-inner"
>
<a
class=
"brand"
href=
"http://www.thymeleaf.org"
>
Thymeleaf -
Plain
</a>
<ul
class=
"nav"
>
<li><a
th:href=
"@{/}"
href=
"home.html"
>
Home
</a></li>
</ul>
</div>
</div>
<h1
th:text=
"${title}"
>
Title
</h1>
<div
th:text=
"${message}"
>
Fake content
</div>
<div
id=
"created"
th:text=
"${#dates.format(date)}"
>
July 11,
2012 2:17:16 PM CDT
</div>
</div>
</body>
</html>
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