DATACMNS-1386 - Avoid strong type dependency to Jackson in SpringDataWebConfiguration.
We now avoid using a Lambda to provide a default ObjectMapper instance in the code that's reflectively guarded against Jackson not being present. The lambda causes a method to be generated for the class that will require ObjectMapper to be present on reflection inspection of that method. Switching to a method reference to ObjectMapper's constructor resolves that problem as the indirection via the additional, offending method is not needed. Further reading: https://www.javabullets.com/how-lambdas-and-anonymous-inner-classesaic-work/
This commit is contained in:
@@ -158,7 +158,7 @@ public class SpringDataWebConfiguration implements WebMvcConfigurer, BeanClassLo
|
||||
if (ClassUtils.isPresent("com.jayway.jsonpath.DocumentContext", context.getClassLoader())
|
||||
&& ClassUtils.isPresent("com.fasterxml.jackson.databind.ObjectMapper", context.getClassLoader())) {
|
||||
|
||||
ObjectMapper mapper = getUniqueBean(ObjectMapper.class, context, () -> new ObjectMapper());
|
||||
ObjectMapper mapper = getUniqueBean(ObjectMapper.class, context, ObjectMapper::new);
|
||||
|
||||
ProjectingJackson2HttpMessageConverter converter = new ProjectingJackson2HttpMessageConverter(mapper);
|
||||
converter.setBeanFactory(context);
|
||||
|
||||
Reference in New Issue
Block a user