forked from xuwujing/springBoot-study
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
251 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>1.0.0</groupId> | ||
<artifactId>springboot-actuator</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
|
||
<name>springboot-actuator</name> | ||
<url>http://maven.apache.org</url> | ||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | ||
<java.version>1.8</java.version> | ||
<maven.compiler.source>1.8</maven.compiler.source> | ||
<maven.compiler.target>1.8</maven.compiler.target> | ||
</properties> | ||
|
||
<parent> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-parent</artifactId> | ||
<version>1.5.9.RELEASE</version> | ||
<relativePath/> | ||
</parent> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-web</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-actuator</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-test</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-devtools</artifactId> | ||
<optional>true</optional> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
</project> |
42 changes: 42 additions & 0 deletions
42
springboot-actuator/src/main/java/com/pancm/ActuatorApp.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package com.pancm; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
|
||
/** | ||
* | ||
* @Title: ActuatorApp | ||
* @Description: | ||
启动程序之后,在浏览器输入: http://localhost:8888/monitor 加上 | ||
1. /autoconfig 可以得到配置生效信息 | ||
2. /configprops 可以得到属性的内容和默认值 | ||
3. /beans 可 以得到bean的别名、类型、是否单例、类的地址、依赖等信息 | ||
4. /dump 可 以得到线程名、线程ID、线程的状态、是否等待锁资源等信息 | ||
5. /env 可以得到环境变量、JVM 属性、命令行参数、项目使用的jar包等信息 | ||
5.1 /sun.boot.library.path 可以得到JDK安装路径 | ||
6. /health 可以得到磁盘检测和数据库检测等信息 | ||
7. /mappings 可以得到全部的URI路径,以及它们和控制器的映射关系 | ||
8. /metrics 可以得到JVM内容使用、GC情况、类加载信息 | ||
8.1 /gc.* 可以得到GC相关信息 | ||
8.2 /mem.* 可以得到内存信息 | ||
... | ||
9. /info 可以得到自定义的配置信息 | ||
10. /shutdown 可以进行关闭程序 post请求 | ||
11. /trace 可以得到所Web请求的详细信息 | ||
* @Version:1.0.0 | ||
* @author pancm | ||
* @date 2019年1月17日 | ||
*/ | ||
@SpringBootApplication | ||
public class ActuatorApp | ||
{ | ||
public static void main( String[] args ) | ||
{ | ||
SpringApplication.run(ActuatorApp.class, args); | ||
System.out.println("Actuator启动成功!"); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
springboot-actuator/src/main/java/com/pancm/web/HelloWorldController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.pancm.web; | ||
|
||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
public class HelloWorldController { | ||
|
||
@RequestMapping("/hello") | ||
public String index(String name) { | ||
return "Hello " + name; | ||
} | ||
|
||
} |
8 changes: 8 additions & 0 deletions
8
springboot-actuator/src/main/java/com/pancm/web/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** | ||
* @Title: package-info | ||
* @Description: | ||
* @Version:1.0.0 | ||
* @author pancm | ||
* @date 2019年1月17日 | ||
*/ | ||
package com.pancm.web; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
server: | ||
port: 8181 | ||
management: | ||
security: | ||
enabled: false #关掉安全认证 | ||
port: 8888 #管理端口 | ||
context-path: /monitor #actuator的访问路径 | ||
|
||
# 是否允许关闭 | ||
endpoints: | ||
shutdown: | ||
enabled: true | ||
|
||
|
||
info: | ||
app: | ||
name:springboot-actuator | ||
version:1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.pancm; | ||
|
||
import junit.framework.Test; | ||
import junit.framework.TestCase; | ||
import junit.framework.TestSuite; | ||
|
||
/** | ||
* Unit test for simple App. | ||
*/ | ||
public class AppTest | ||
extends TestCase | ||
{ | ||
/** | ||
* Create the test case | ||
* | ||
* @param testName name of the test case | ||
*/ | ||
public AppTest( String testName ) | ||
{ | ||
super( testName ); | ||
} | ||
|
||
/** | ||
* @return the suite of tests being tested | ||
*/ | ||
public static Test suite() | ||
{ | ||
return new TestSuite( AppTest.class ); | ||
} | ||
|
||
/** | ||
* Rigourous Test :-) | ||
*/ | ||
public void testApp() | ||
{ | ||
assertTrue( true ); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Manifest-Version: 1.0 | ||
Implementation-Title: springboot-actuator | ||
Implementation-Version: 0.0.1-SNAPSHOT | ||
Built-By: Administrator | ||
Implementation-Vendor-Id: 1.0.0 | ||
Build-Jdk: 1.8.0_131 | ||
Implementation-URL: http://maven.apache.org | ||
Created-By: Maven Integration for Eclipse | ||
Implementation-Vendor: Pivotal Software, Inc. | ||
|
7 changes: 7 additions & 0 deletions
7
springboot-actuator/target/classes/META-INF/maven/1.0.0/springboot-actuator/pom.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#Generated by Maven Integration for Eclipse | ||
#Thu Jan 17 16:50:21 CST 2019 | ||
version=0.0.1-SNAPSHOT | ||
groupId=1.0.0 | ||
m2e.projectName=springboot-actuator | ||
m2e.projectLocation=D\:\\git\\GitHub\\springBoot-study\\springboot-actuator | ||
artifactId=springboot-actuator |
48 changes: 48 additions & 0 deletions
48
springboot-actuator/target/classes/META-INF/maven/1.0.0/springboot-actuator/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>1.0.0</groupId> | ||
<artifactId>springboot-actuator</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
|
||
<name>springboot-actuator</name> | ||
<url>http://maven.apache.org</url> | ||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | ||
<java.version>1.8</java.version> | ||
<maven.compiler.source>1.8</maven.compiler.source> | ||
<maven.compiler.target>1.8</maven.compiler.target> | ||
</properties> | ||
|
||
<parent> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-parent</artifactId> | ||
<version>1.5.9.RELEASE</version> | ||
<relativePath/> | ||
</parent> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-web</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-actuator</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-test</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-devtools</artifactId> | ||
<optional>true</optional> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
server: | ||
port: 8181 | ||
management: | ||
security: | ||
enabled: false #关掉安全认证 | ||
port: 8888 #管理端口 | ||
context-path: /monitor #actuator的访问路径 | ||
|
||
# 是否允许关闭 | ||
endpoints: | ||
shutdown: | ||
enabled: true | ||
|
||
|
||
info: | ||
app: | ||
name:springboot-actuator | ||
version:1.0 |