fix: make enums case-insensitive so that the hangar publish plugin can be used with groovy

This commit is contained in:
MiniDigger | Martin 2024-03-23 15:44:44 +01:00
parent 0752ec5e05
commit 9698115aa9

View File

@ -0,0 +1,21 @@
package io.papermc.hangar.config.jackson;
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
@Configuration
public class JacksonConfig {
@Bean
@Primary
ObjectMapper jacksonObjectMapper(final Jackson2ObjectMapperBuilder builder) {
return builder
.createXmlMapper(false)
.featuresToEnable(MapperFeature.ACCEPT_CASE_INSENSITIVE_ENUMS)
.build();
}
}