Spring IoC: Dependency not found

164 Views Asked by At

This is my code:

@Bean("incidencies")
public Jaxb2Marshaller incidenciesMarshaller() {
    Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
    marshaller.setContextPath("cat.gencat.catsalut.hes.visor.api.common.domain.incidencies");
    return marshaller;
}

@Bean
public IncidenciesWebServiceGatewaySupport incidenciesClientConnector(
    @Qualifier("incidencies") Jaxb2Marshaller marshaller,
    ...

I'm getting this error message:

***************************
APPLICATION FAILED TO START
***************************

Description:

Parameter 0 of method incidenciesClientConnector in cat.gencat.catsalut.hes.visor.api.common.configuration.VisorApiConfiguration required a bean of type 'org.springframework.oxm.jaxb.Jaxb2Marshaller' that could not be found.

I don't quite figure out what's wrong.

Any ideas?

1

There are 1 best solutions below

1
Akif Hadziabdic On

You just need a Qualifier with Bean.

@Bean()
@Qualifier("incidencies") 
public Jaxb2Marshaller incidenciesMarshaller() {
    ...
}