Возникла проблема с созданием ошибки при создании компонента с именем 'objectMapper', определенным в ресурсе пути к классу. Единственное изменение, которое я сделал, было
обновление pom.xml из
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.10</version>
</dependency>
<dependency>
to
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.10.0.pr3</version>
</dependency>
<dependency>
При выполнении моего проекта я получаю следующую ошибку
019-10-16 14:04:50.065 [CorrelationId=] ERROR --- [ main] o.s.b.w.e.t.TomcatStarter : Error starting Tomcat context. Exception: org.springframework.beans.factory.BeanCreationException.
Message: Error creating bean with name 'org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration':
Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException:
Failed to instantiate [org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration$$EnhancerBySpringCGLIB$$c58725a7]:
Constructor threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'resourceConfigCustomizer' defined in class path resource [org/springframework/boot/autoconfigure/jersey/JerseyAutoConfiguration$JacksonResourceConfigCustomizer.class]:
Unsatisfied dependency expressed through method 'resourceConfigCustomizer' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'objectMapper' defined in class path resource [com/test/test/marketing/banditsorchestrator/config/OwaspConfig.class]:
Post-processing of merged bean definition failed; nested exception is java.lang.IllegalStateException:
Failed to introspect Class [com.fasterxml.jackson.databind.ObjectMapper] from ClassLoader [sun.misc.Launcher$AppClassLoader@18b4aac2]
Вот мой код
@ Конфигурация открытого класса OwaspConfig {
private ObjectMapper objectMapper;
@Bean
@Primary
public ObjectMapper objectMapper() {
JsonFactory factory = new JsonFactory();
factory.setCharacterEscapes(new OwaspCharacterEscapes());
objectMapper = new ObjectMapper(factory);
return new ObjectMapper(factory);
}
}