fr.fezlight.eventsystem.config.EventAutoConfiguration Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spring-boot-starter-event-system Show documentation
Show all versions of spring-boot-starter-event-system Show documentation
This library is dedicated for Spring Boot application and is an implementation of an event system
integrated with RabbitMQ and Spring-Modulith-Events.
The newest version!
package fr.fezlight.eventsystem.config;
import com.fasterxml.jackson.databind.ObjectMapper;
import fr.fezlight.eventsystem.EventListeners;
import fr.fezlight.eventsystem.EventService;
import fr.fezlight.eventsystem.annotation.SubscribeEvent;
import fr.fezlight.eventsystem.config.properties.EventProperties;
import fr.fezlight.eventsystem.config.rabbitmq.EventQueueConfig;
import fr.fezlight.eventsystem.models.Event;
import fr.fezlight.eventsystem.models.EventHandler;
import fr.fezlight.eventsystem.models.EventWrapper;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.amqp.support.converter.Jackson2JavaTypeMapper;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import org.springframework.amqp.support.converter.MessageConverter;
import org.springframework.aop.framework.AopProxyUtils;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;
import org.springframework.modulith.events.EventExternalizationConfiguration;
import org.springframework.modulith.events.RoutingTarget;
import org.springframework.stereotype.Component;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.function.Supplier;
import static org.springframework.scheduling.annotation.Scheduled.CRON_DISABLED;
import static org.springframework.util.ObjectUtils.isEmpty;
@ConditionalOnProperty(
value = "events.enabled",
havingValue = "true",
matchIfMissing = true
)
@AutoConfiguration
@EnableConfigurationProperties(EventProperties.class)
@Import(EventQueueConfig.class)
public class EventAutoConfiguration {
@Bean
@SuppressWarnings("unchecked")
public EventRegistryConfig eventRegistryConfig(ApplicationContext applicationContext) {
var registry = new EventRegistryConfig();
Collection
© 2015 - 2025 Weber Informatics LLC | Privacy Policy