diff --git a/orcid-web/src/main/java/org/orcid/frontend/spring/configuration/OrcidBeanClassLoaderAware.java b/orcid-web/src/main/java/org/orcid/frontend/spring/configuration/OrcidBeanClassLoaderAware.java index 4416b66085..0c6d7a4a81 100644 --- a/orcid-web/src/main/java/org/orcid/frontend/spring/configuration/OrcidBeanClassLoaderAware.java +++ b/orcid-web/src/main/java/org/orcid/frontend/spring/configuration/OrcidBeanClassLoaderAware.java @@ -1,11 +1,14 @@ package org.orcid.frontend.spring.configuration; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.databind.ObjectMapper; import org.springframework.beans.factory.BeanClassLoaderAware; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer; import org.springframework.data.redis.serializer.RedisSerializer; +import org.springframework.security.jackson2.CoreJackson2Module; import org.springframework.security.jackson2.SecurityJackson2Modules; @Configuration @@ -25,6 +28,8 @@ public RedisSerializer springSessionDefaultRedisSerializer() { private ObjectMapper objectMapper() { ObjectMapper mapper = new ObjectMapper(); mapper.registerModules(SecurityJackson2Modules.getModules(this.loader)); + mapper.registerModules(new CoreJackson2Module()); + mapper.addMixIn(String[].class, StringArrayMixin.class); return mapper; } @@ -32,4 +37,13 @@ private ObjectMapper objectMapper() { public void setBeanClassLoader(ClassLoader classLoader) { this.loader = classLoader; } + + @JsonTypeInfo( + use = JsonTypeInfo.Id.CLASS + ) + abstract class StringArrayMixin { + @JsonCreator + StringArrayMixin(String[] array) { + } + } }