Skip to content

Commit f9c3aa9

Browse files
committed
/info端点输出Git版本信息
1 parent 650c605 commit f9c3aa9

File tree

5 files changed

+135
-0
lines changed

5 files changed

+135
-0
lines changed

Chapter6-2-1/pom.xml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
6+
<groupId>com.didispace</groupId>
7+
<artifactId>Chapter6-2-1</artifactId>
8+
<version>1.0.0</version>
9+
<packaging>jar</packaging>
10+
11+
<name>Chapter6-2-1</name>
12+
<description></description>
13+
14+
<parent>
15+
<groupId>org.springframework.boot</groupId>
16+
<artifactId>spring-boot-starter-parent</artifactId>
17+
<version>1.5.3.RELEASE</version>
18+
<relativePath/> <!-- lookup parent from repository -->
19+
</parent>
20+
21+
<properties>
22+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
23+
<java.version>1.8</java.version>
24+
</properties>
25+
26+
<dependencies>
27+
<dependency>
28+
<groupId>org.springframework.boot</groupId>
29+
<artifactId>spring-boot-starter-test</artifactId>
30+
<scope>test</scope>
31+
</dependency>
32+
33+
<dependency>
34+
<groupId>org.springframework.boot</groupId>
35+
<artifactId>spring-boot-starter-web</artifactId>
36+
</dependency>
37+
38+
<dependency>
39+
<groupId>org.springframework.boot</groupId>
40+
<artifactId>spring-boot-starter-actuator</artifactId>
41+
</dependency>
42+
43+
</dependencies>
44+
45+
<build>
46+
<plugins>
47+
<plugin>
48+
<groupId>org.springframework.boot</groupId>
49+
<artifactId>spring-boot-maven-plugin</artifactId>
50+
</plugin>
51+
<plugin>
52+
<groupId>pl.project13.maven</groupId>
53+
<artifactId>git-commit-id-plugin</artifactId>
54+
<version>2.1.15</version>
55+
<executions>
56+
<execution>
57+
<goals>
58+
<goal>revision</goal>
59+
</goals>
60+
</execution>
61+
</executions>
62+
<configuration>
63+
<dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
64+
</configuration>
65+
</plugin>
66+
</plugins>
67+
</build>
68+
69+
</project>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package com.didispace;
2+
3+
import org.springframework.boot.SpringApplication;
4+
import org.springframework.boot.autoconfigure.SpringBootApplication;
5+
6+
/**
7+
*
8+
* @author 程序猿DD
9+
* @version 1.0.0
10+
* @blog http://blog.didispace.com
11+
*
12+
*/
13+
@SpringBootApplication
14+
public class Application {
15+
16+
public static void main(String[] args) {
17+
18+
SpringApplication.run(Application.class, args);
19+
20+
}
21+
22+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.didispace.web;
2+
3+
import org.springframework.web.bind.annotation.RequestMapping;
4+
import org.springframework.web.bind.annotation.RestController;
5+
6+
/**
7+
*
8+
* @author 程序猿DD
9+
* @version 1.0.0
10+
* @blog http://blog.didispace.com
11+
*
12+
*/
13+
@RestController
14+
public class HelloController {
15+
16+
@RequestMapping("/hello")
17+
public String index() {
18+
return "Hello World";
19+
}
20+
21+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#management.info.git.mode=full
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package com.didispace;
2+
3+
import org.junit.Test;
4+
import org.springframework.boot.test.context.SpringBootTest;
5+
6+
7+
/**
8+
*
9+
* @author 程序猿DD
10+
* @version 1.0.0
11+
* @blog http://blog.didispace.com
12+
*
13+
*/
14+
@SpringBootTest
15+
public class ApplicationTests {
16+
17+
@Test
18+
public void test1() throws Exception {
19+
20+
}
21+
22+
}

0 commit comments

Comments
 (0)