Injecting object in Aggregate command Handler without spring boot


I have a configuration that looks as following :

I’m experiencing the same issue – however, instead of autowiring in the function I autowire at initialization… for example:


public class BidAggregate {


private String id;


private BidServicesHelper bidhelper;


private HashMap<String,String> participantCache;

Needless to say, all my autowires are null

Autowires are null, because Spring doesn’t manage your aggregates, hence, @Autowired is ignored.

David, the class I think you intend to use is the SpringBeanParameterResolverFactory. That’s the ParameterResolver that allows you to resolve Spring Beans declared as parameters to @…Handler methods.
Note that when using Spring Boot, this is autoconfigured.

You may have to register the ParameterResolver with the configurer as a component:

MultiParameterResolverFactory.ordered(ClasspathParameterResolverFactory.forClass(getClass()), new ConfigurationParameterResolverFactory(config),
/* add your own here */)

Hope this helps.