Injecting object in Aggregate command Handler without spring boot

Hi,

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:

@Aggregate(repository=“bidAggregateRepository”)

public class BidAggregate {

@AggregateIdentifier

private String id;

@Autowired

private BidServicesHelper bidhelper;

@Autowired

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:
configurer.registerComponent(ParameterResolverFactory.class,

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

Hope this helps.
Cheers,