#35 springboot: actuator - basic

This commit is contained in:
haerong22
2023-03-22 01:39:01 +09:00
parent 6dfc13256b
commit 286fb89c2f
6 changed files with 62 additions and 28 deletions

View File

@@ -1,27 +0,0 @@
# Getting Started
### Reference Documentation
For further reference, please consider the following sections:
* [Official Gradle documentation](https://docs.gradle.org)
* [Spring Boot Gradle Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/3.0.0/gradle-plugin/reference/html/)
* [Create an OCI image](https://docs.spring.io/spring-boot/docs/3.0.0/gradle-plugin/reference/html/#build-image)
* [Spring Web](https://docs.spring.io/spring-boot/docs/3.0.0/reference/htmlsingle/#web)
* [Spring Data JPA](https://docs.spring.io/spring-boot/docs/3.0.0/reference/htmlsingle/#data.sql.jpa-and-spring-data)
### Guides
The following guides illustrate how to use some features concretely:
* [Building a RESTful Web Service](https://spring.io/guides/gs/rest-service/)
* [Serving Web Content with Spring MVC](https://spring.io/guides/gs/serving-web-content/)
* [Building REST services with Spring](https://spring.io/guides/tutorials/rest/)
* [Accessing Data with JPA](https://spring.io/guides/gs/accessing-data-jpa/)
### Additional Links
These additional references should also help you:
* [Gradle Build Scans insights for your project's build](https://scans.gradle.com#gradle)

View File

@@ -2,6 +2,7 @@ plugins {
id 'java'
id 'org.springframework.boot' version '3.0.2'
id 'io.spring.dependency-management' version '1.1.0'
id 'com.gorylenko.gradle-git-properties' version '2.4.1'
}
group = 'hello'
@@ -36,3 +37,7 @@ dependencies {
tasks.named('test') {
useJUnitPlatform()
}
springBoot {
buildInfo()
}

View File

@@ -1,7 +1,9 @@
package hello;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.actuate.web.exchanges.InMemoryHttpExchangeRepository;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
@SpringBootApplication
public class ActuatorApplication {
@@ -10,4 +12,8 @@ public class ActuatorApplication {
SpringApplication.run(ActuatorApplication.class, args);
}
@Bean
public InMemoryHttpExchangeRepository httpExchangeRepository() {
return new InMemoryHttpExchangeRepository();
}
}

View File

@@ -0,0 +1,20 @@
package hello.controller;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@Slf4j
@RestController
public class LogController {
@GetMapping("/log")
public String log() {
log.trace("trace log");
log.debug("debug log");
log.info("info log");
log.warn("warn log");
log.error("error log");
return "ok";
}
}

View File

@@ -0,0 +1,31 @@
management:
server:
port: 9292
info:
java:
enabled: true
os:
enabled: true
env:
enabled: true
git:
mode: full
endpoint:
shutdown:
enabled: true
health:
# show-details: always
show-components: always
endpoints:
web:
exposure:
include: "*"
info:
app:
name: hello-actuator
company: wj
logging:
level:
hello.controller: debug