Class AvroConverterAutoConfiguration
java.lang.Object
org.axonframework.extension.springboot.autoconfig.AvroConverterAutoConfiguration
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanClassLoaderAware
@AutoConfiguration
@AutoConfigureBefore(ConverterAutoConfiguration.class)
@ConditionalOnClass(name="org.apache.avro.message.SchemaStore")
@EnableConfigurationProperties(ConverterProperties.class)
public class AvroConverterAutoConfiguration
extends Object
implements org.springframework.beans.factory.BeanClassLoaderAware
Autoconfigures the
AvroConverter, if configured via the ConverterProperties.- Since:
- 5.1.0
- Author:
- Jakob Hatzl
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionBean creation method to throw anAxonConfigurationException, indicating that theAvroConverteris not supported as general converter.delegatingEventConverter(MessageConverter messageConverter) Bean creation method constructing anEventConverterdelegating to theMessageConverterin case both useavro.eventConverter(org.apache.avro.message.SchemaStore schemaStore, Map<String, AvroConverterStrategy> converterStrategies) Bean creation method constructing anAvroConverteras theEventConverterto be used by Axon Framework.messageConverter(org.apache.avro.message.SchemaStore schemaStore, Map<String, AvroConverterStrategy> converterStrategies) Bean creation method constructing anAvroConverteras theMessageConverterto be used by Axon Framework.voidsetBeanClassLoader(ClassLoader classLoader) Sets the class loader used by theChainingContentTypeConverterto loadContentTypeConverters.
-
Constructor Details
-
AvroConverterAutoConfiguration
public AvroConverterAutoConfiguration()
-
-
Method Details
-
converter
@Bean @Primary @ConditionalOnMissingBean(ignored={MessageConverter.class,EventConverter.class}) @ConditionalOnProperty(name="axon.converter.general", havingValue="avro") public GeneralConverter converter()Bean creation method to throw anAxonConfigurationException, indicating that theAvroConverteris not supported as general converter.- Returns:
- always throws
AxonConfigurationExceptionto indicate misconfiguration
-
messageConverter
@Bean @ConditionalOnMissingBean @ConditionalOnProperty(name="axon.converter.messages", havingValue="avro") public MessageConverter messageConverter(org.apache.avro.message.SchemaStore schemaStore, Map<String, AvroConverterStrategy> converterStrategies) Bean creation method constructing anAvroConverteras theMessageConverterto be used by Axon Framework.- Parameters:
schemaStore- the AvroSchemaStoreto be usedconverterStrategies- theAvroConverterStrategiesto be used- Returns:
- the
MessageConverterto be used by Axon Framework
-
delegatingEventConverter
@Bean(name="eventConverter") @ConditionalOnMissingBean @ConditionalOnExpression("\'${axon.converter.events}\' == \'avro\' && \'${axon.converter.messages}\' == \'avro\'") public EventConverter delegatingEventConverter(MessageConverter messageConverter) Bean creation method constructing anEventConverterdelegating to theMessageConverterin case both useavro.- Parameters:
messageConverter- theMessageConverter, used to construct theEventConverterin case both useavro- Returns:
- the
EventConverterto be used by Axon Framework
-
eventConverter
@Bean @ConditionalOnMissingBean @ConditionalOnExpression("\'${axon.converter.events}\' == \'avro\' && \'${axon.converter.messages}\' != \'avro\'") public EventConverter eventConverter(org.apache.avro.message.SchemaStore schemaStore, Map<String, AvroConverterStrategy> converterStrategies) Bean creation method constructing anAvroConverteras theEventConverterto be used by Axon Framework.- Parameters:
schemaStore- the AvroSchemaStoreto be usedconverterStrategies- theAvroConverterStrategiesto be used- Returns:
- the
EventConverterto be used by Axon Framework
-
setBeanClassLoader
Sets the class loader used by theChainingContentTypeConverterto loadContentTypeConverters.- Specified by:
setBeanClassLoaderin interfaceorg.springframework.beans.factory.BeanClassLoaderAware- Parameters:
classLoader- The class loader used by theChainingContentTypeConverterto loadContentTypeConverters
-