Get useful metrics to monitor your app With Spring Actuator API several useful metrics can be exposed that you can use to monitor your Spring Boot application. Metrics like application health or the last HTTP requests. I’ll show you how to do that. I’ve made an example project you can found at https://github.com/claudioaltamura/docker-springboot-helloworld. After starting …
Kategorie-Archive: Spring
Trace http requests with Spring Actuator
List the last http request with ease Spring Actuator provides also a httptrace endpoint. You get the last HTTP request with /httptrace. After adding Spring Boot Actuator dependencies to your project dependencies, you have to expose the httptrace endpoint via your application.properties: [code]management.endpoints.web.exposure.include=httptrace[/code] [code] curl http://127.0.0.1:8080/actuator/httptrace | jq { "traces": [{ "timestamp": "2019-01-05T07:45:14.406Z", "principal": null, …
Change your application log level with Spring Actuator
You can do it even at runtime 🙂 Spring Boot provides a loggers actuator endpoint for viewing and changing log levels at runtime. What do I need? Add the Spring Boot Starter Actuator to you pom.xml or build.gradleorg.springframework.boot:spring-boot-starter-actuator Expose at least the loggers endpoint in your application.propertiesmanagement.endpoints.web.exposure.include=loggers When exposed, you get all loggers details with /loggers: …
„Change your application log level with Spring Actuator“ weiterlesen
Spring und Unit-Tests mit Mockito
Ich hatte mich schon längere Zeit gefragt, ob ich nicht noch einfacher auf die Mocks zugreifen kann, um das Verhalten zu manipulieren. Also recherierte ich ein bißchen und bin dann bei der neusten Mockito-Version (1.9.5) auf die Annotations @Mock und @InjectMocks aufmerksam gewurden. [code language=“java“] package de.claudioaltamura.spring.mockito.example.controller; … import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import …