Change UUID encoding to base-32 in spring-data-rest HAL _links

Viewed 98

We recently began converting our controllers over to spring-data-rest repositories but in our system we must encode UUIDs in base-32.

We were able to solve this for the response content and the urls using the RepositoryRestConfigurer but the UUIDs still show in the standard format in the _links.

Current jackson mapper config:

@Override
public void configureConversionService(ConfigurableConversionService conversionService)
{
  conversionService.addConverter(String.class, UUID.class, new StringUuidConverter());
}

@Override public void configureJacksonObjectMapper(ObjectMapper objectMapper)
{
  SimpleModule module = new SimpleModule();
  module.addSerializer(UUID.class, new UUIDSerialiser());
  module.addDeserializer(UUID.class, new UUIDDeserialiser());

  objectMapper.registerModule(module);
}

Is there a similar way to change the _links?

Edit: We have decided to enable support for dash separated uuids along with base32 in incoming requests. This is not a great solution however as it is confusing for clients that our _links are not base32 so we are still looking for a proper solution

1 Answers

By default, the liveness and readiness probe paths use Spring Boot 2.x+ actuator endpoints. To use Spring Boot 1.x actuator endpoint paths, you must adjust the liveness and readiness values, as the following example shows (replace with the name of your application):

deployer.<application>.kubernetes.livenessProbePath=/health
deployer.<application>.kubernetes.readinessProbePath=/info

To automatically set both liveness and readiness endpoints on a per-application basis to the default Spring Boot 1.x paths, you can set the following property:

deployer.<application>.kubernetes.bootMajorVersion=1
Related