简体   繁体   中英

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

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM