Class JacksonConverterAutoConfiguration

java.lang.Object
org.axonframework.extension.springboot.autoconfig.JacksonConverterAutoConfiguration
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanClassLoaderAware

@AutoConfiguration @AutoConfigureBefore({AxonAutoConfiguration.class,ConverterAutoConfiguration.class,Jackson2ConverterAutoConfiguration.class}) @AutoConfigureAfter(name={"org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration","org.springframework.boot.jackson.autoconfigure.JacksonAutoConfiguration"}) @ConditionalOnClass(name="tools.jackson.databind.ObjectMapper") @EnableConfigurationProperties(ConverterProperties.class) public class JacksonConverterAutoConfiguration extends Object implements org.springframework.beans.factory.BeanClassLoaderAware
Autoconfigures the JacksonConverter if configured via the ConverterProperties.
Since:
5.1.0
Author:
Jakob Hatzl
  • Constructor Details

    • JacksonConverterAutoConfiguration

      public JacksonConverterAutoConfiguration()
  • Method Details

    • converter

      @Bean @Primary @ConditionalOnMissingBean(ignored={MessageConverter.class,EventConverter.class}) @ConditionalOnExpression("\'${axon.converter.general}\' == \'jackson\' || \'${axon.converter.general:default}\' == \'default\'") public GeneralConverter converter(tools.jackson.databind.ObjectMapper objectMapper)
      Bean creation method constructing a JacksonConverter as the GeneralConverter to be used by Axon Framework.

      This bean acts as fallback and gets created in case axon.converter.general is not set or set to default.

      Parameters:
      objectMapper - the ObjectMapper to be used
      Returns:
      the GeneralConverter to be used by Axon Framework
    • delegatingMessageConverter

      @Bean(name="messageConverter") @ConditionalOnMissingBean @ConditionalOnExpression("\'${axon.converter.messages}\' == \'jackson\'\n&& (\'${axon.converter.general}\' == \'jackson\' || \'${axon.converter.general:default}\' == \'default\')\n") public MessageConverter delegatingMessageConverter(GeneralConverter generalConverter)
      Bean creation method constructing a MessageConverter delegating to the GeneralConverter in case both use jackson/default.
      Parameters:
      generalConverter - the GeneralConverter, used to construct the MessageConverter in case both use jackson/default
      Returns:
      the MessageConverter to be used by Axon Framework
    • messageConverter

      @Bean @ConditionalOnMissingBean @ConditionalOnExpression("\'${axon.converter.messages}\' == \'jackson\'\n&& !(\'${axon.converter.general}\' == \'jackson\' || \'${axon.converter.general:default}\' == \'default\')\n") public MessageConverter messageConverter(tools.jackson.databind.ObjectMapper objectMapper)
      Bean creation method constructing a JacksonConverter as the MessageConverter to be used by Axon Framework.
      Parameters:
      objectMapper - the ObjectMapper to be used
      Returns:
      the MessageConverter to be used by Axon Framework
    • delegatingEventConverter

      @Bean(name="eventConverter") @ConditionalOnMissingBean @ConditionalOnExpression("\'${axon.converter.events}\' == \'jackson\' && \'${axon.converter.messages}\' == \'jackson\'") public EventConverter delegatingEventConverter(MessageConverter messageConverter)
      Bean creation method constructing an EventConverter delegating to the MessageConverter in case both use jackson.
      Parameters:
      messageConverter - the MessageConverter, used to construct the EventConverter in case both use jackson
      Returns:
      the EventConverter to be used by Axon Framework
    • eventConverter

      @Bean @ConditionalOnMissingBean @ConditionalOnExpression("\'${axon.converter.events}\' == \'jackson\' && \'${axon.converter.messages}\' != \'jackson\'") public EventConverter eventConverter(tools.jackson.databind.ObjectMapper objectMapper)
      Bean creation method constructing a JacksonConverter as the EventConverter to be used by Axon Framework.
      Parameters:
      objectMapper - the ObjectMapper to be used
      Returns:
      the EventConverter to be used by Axon Framework
    • setBeanClassLoader

      public void setBeanClassLoader(ClassLoader classLoader)
      Sets the class loader used by the ChainingContentTypeConverter to load ContentTypeConverters.
      Specified by:
      setBeanClassLoader in interface org.springframework.beans.factory.BeanClassLoaderAware
      Parameters:
      classLoader - the class loader used by the ChainingContentTypeConverter to load ContentTypeConverters