[CST-5288] Introduced spring boot actuators

This commit is contained in:
Luca Giamminonni
2022-02-11 18:34:25 +01:00
parent 579d926e95
commit e4857c0b1d
4 changed files with 50 additions and 1 deletions

View File

@@ -279,6 +279,12 @@
<artifactId>spring-boot-starter-aop</artifactId>
<version>${spring-boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<version>${spring-boot.version}</version>
</dependency>
<dependency>
<groupId>com.flipkart.zjsonpatch</groupId>

View File

@@ -0,0 +1,39 @@
/**
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source
* tree and available online at
*
* http://www.dspace.org/license/
*/
package org.dspace.app.rest.configuration;
import java.util.Arrays;
import org.dspace.app.rest.DiscoverableEndpointsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.event.EventListener;
import org.springframework.hateoas.Link;
/**
* Configuration class related to the actuator endpoints.
*
* @author Luca Giamminonni (luca.giamminonni at 4science.it)
*
*/
@Configuration
public class ActuatorConfiguration {
@Autowired
private DiscoverableEndpointsService discoverableEndpointsService;
@Value("${management.endpoints.web.base-path:/actuator}")
private String actuatorBasePath;
@EventListener(ApplicationReadyEvent.class)
public void registerActuatorEndpoints() {
discoverableEndpointsService.register(this, Arrays.asList(new Link(actuatorBasePath, "actuator")));
}
}

View File

@@ -81,7 +81,7 @@ public class WebSecurityConfiguration extends WebSecurityConfigurerAdapter {
// Configure authentication requirements for ${dspace.server.url}/api/ URL only
// NOTE: REST API is hardcoded to respond on /api/. Other modules (OAI, SWORD, IIIF, etc) use other root paths.
http.requestMatchers()
.antMatchers("/api/**", "/iiif/**")
.antMatchers("/api/**", "/iiif/**", "/actuator/**")
.and()
// Enable Spring Security authorization on these paths
.authorizeRequests()

View File

@@ -132,3 +132,7 @@ spring.servlet.multipart.max-file-size = 512MB
# Maximum size of a multipart request (i.e. max total size of all files in one request) (default = 10MB)
spring.servlet.multipart.max-request-size = 512MB
#Spring Boot actuator configuration
management.endpoint.health.show-details = when-authorized
management.endpoint.health.roles = ADMIN