Instantly share code, notes, and snippets.

Embed
What would you like to do?
@PostConstruct
public void initHandlerMap() {
BeanManager beanManager = BeanManagerProvider.retrieve();
Set<Bean<?>> allHandlers = beanManager.getBeans(GenericCommandHandler.class);
for (Bean<?> bean : allHandlers) {
Class<?> handlerClass = bean.getBeanClass();
Class<?> handledCommandType = getHandledCommandType(handlerClass);
handlers.put(handledCommandType, bean.getName());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment