Skip to content

Commit 64f07a1

Browse files
committed
Added Actuator with links on home page to quickly see the status of the application
1 parent 72f775b commit 64f07a1

File tree

3 files changed

+121
-2
lines changed

3 files changed

+121
-2
lines changed

pom.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
<properties>
1212
<java.version>1.8</java.version>
13-
<tomcat.version>8.0.9</tomcat.version>
13+
<tomcat.version>7.0.53</tomcat.version>
1414
<junit.version>4.11</junit.version>
1515
</properties>
1616

@@ -31,6 +31,11 @@
3131
<groupId>org.springframework.boot</groupId>
3232
<artifactId>spring-boot-starter-thymeleaf</artifactId>
3333
</dependency>
34+
<dependency>
35+
<groupId>org.springframework.boot</groupId>
36+
<artifactId>spring-boot-starter-actuator</artifactId>
37+
</dependency>
38+
<!-- WebJars -->
3439
<dependency>
3540
<groupId>org.webjars</groupId>
3641
<artifactId>bootstrap</artifactId>

src/main/java/pl/codeleak/demos/sbt/home/HomeController.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import org.springframework.stereotype.Controller;
44
import org.springframework.web.bind.annotation.RequestMapping;
5+
import org.springframework.web.bind.annotation.ResponseBody;
56

67
@Controller
78
class HomeController {
@@ -10,4 +11,10 @@ class HomeController {
1011
String index() {
1112
return "index";
1213
}
14+
15+
@RequestMapping("properties")
16+
@ResponseBody
17+
java.util.Properties properties() {
18+
return System.getProperties();
19+
}
1320
}

src/main/resources/templates/index.html

Lines changed: 108 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,116 @@ <h1>Test</h1>
4141
Welcome to the Spring Boot Thymeleaf Application!
4242
</p>
4343
<p>
44-
<a href="#" class="btn btn-large btn-success">Sign up</a>
44+
<a href="#" th:href="@{properties}" class="btn btn-large btn-success">System Properties</a>
4545
</p>
4646
</div>
47+
<div>
48+
<h1>Spring Actuator</h1>
49+
<p>
50+
Actuator endpoints allow you to monitor and interact with your application.
51+
Spring Boot includes a number of built-in endpoints and you can also add your own.
52+
</p>
53+
<table>
54+
<thead>
55+
<tr>
56+
<th>ID</th>
57+
<th>Description</th>
58+
</tr>
59+
</thead>
60+
<tbody>
61+
<tr>
62+
<td>
63+
<p><a href="#" th:href="@{autoconfig}">autoconfig</a></p>
64+
</td>
65+
<td>
66+
<p>Displays an auto-configuration report showing all auto-configuration candidates and the
67+
reason why they “were” or “were not” applied.</p>
68+
</td>
69+
</tr>
70+
<tr>
71+
<td>
72+
<p><a href="#" th:href="@{beans}">beans</a></p>
73+
</td>
74+
<td>
75+
<p>Displays a complete list of all the Spring Beans in your application</p>
76+
</td>
77+
</tr>
78+
<tr>
79+
<td>
80+
<p><a href="#" th:href="@{configprops}">configprops</a></p>
81+
</td>
82+
<td>
83+
<p>Displays a collated list of all <code class="literal">@ConfigurationProperties</code>.</p>
84+
</td>
85+
</tr>
86+
<tr>
87+
<td>
88+
<p><a href="#" th:href="@{dump}">dump</a></p>
89+
</td>
90+
<td>
91+
<p>Performs a thread dump.</p>
92+
</td>
93+
</tr>
94+
<tr>
95+
<td>
96+
<p><a href="#" th:href="@{env}">env</a></p>
97+
</td>
98+
<td>
99+
<p>Exposes properties from Spring’s <code class="literal">ConfigurableEnvironment</code>.</p>
100+
</td>
101+
</tr>
102+
<tr>
103+
<td>
104+
<p><a href="#" th:href="@{health}">health</a></p>
105+
</td>
106+
<td>
107+
<p>Shows application health information (defaulting to a simple “OK” message).</p>
108+
</td>
109+
</tr>
110+
<tr>
111+
<td>
112+
<p><a href="#" th:href="@{info}">info</a></p>
113+
</td>
114+
<td>
115+
<p>Displays arbitrary application info.</p>
116+
</td>
117+
</tr>
118+
<tr>
119+
<td>
120+
<p><a href="#" th:href="@{metrics}">metrics</a></p>
121+
</td>
122+
<td>
123+
<p>Shows “metrics” information for the current application.</p>
124+
</td>
125+
</tr>
126+
<tr>
127+
<td>
128+
<p><a href="#" th:href="@{mappings}">mappings</a></p>
129+
</td>
130+
<td>
131+
<p>Displays a collated list of all <code class="literal">@RequestMapping</code> paths.</p>
132+
</td>
133+
</tr>
134+
<tr>
135+
<td>
136+
<p><a href="#" th:href="@{shutdown}">shutdown</a></p>
137+
</td>
138+
<td>
139+
<p>Allows the application to be gracefully shutdown (not enabled by default).</p>
140+
</td>
141+
</tr>
142+
<tr>
143+
<td>
144+
<p><a href="#" th:href="@{trace}">trace</a></p>
145+
</td>
146+
<td>
147+
<p>Displays trace information (by
148+
default the last few HTTP requests).</p>
149+
</td>
150+
</tr>
151+
</tbody>
152+
</table>
153+
</div>
47154
<div th:replace="fragments/footer :: footer">&copy; 2014 The Static Templates</div>
48155
</div>
49156
</body>

0 commit comments

Comments
 (0)