Spring injects null instead of a class instance

109 views Asked by At

Here's a piece of Spring config file:

@Bean
public GenericDao<Foo> fooDao() {
    return new GenericDao<>(Foo.class);
}

@Bean
@DependsOn("fooDao")
public GenericService<Foo> fooService() {
    return new ApplicationGenericService<>(fooDao(), applicationMessageProducer());
}

@Bean
@DependsOn("fooService")
public GenericService<Foo> decoratedFooService() {
    return new ServiceDecorator<>(fooService(), decoratorService());
}

For some reason, Spring passes null to ApplicationGenericService constructor.

Any ideas how to fix this issue?

0

There are 0 answers