@Lookup method does not work with spring mvc 4.1

Pikappa :

I want to use the @Lookup method's annotation into the project I'm working with. The @Component is declared as follow:

@Component
@Scope("prototype")
public class TracciatoCoperturaMondialpolManager {
//some code
}

And my method is declared as follow into a @Service class:

@Lookup
private TracciatoCoperturaMondialpolManager getTracciatoMondialpolManagerPrototype() {
    return null;
}

but when I call the method from the service class where is wrote, it returns null. I try even with xml as follow:

<bean id="tracciatoCoperturaMondialpolManager" class="it.sabacom.amministrativo.tracciati.copertura.TracciatoCoperturaMondialpolManager" scope="prototype" />

<bean id="decodificaService ----
...some xml definitions
        <lookup-method name="getTracciatoMondialpolManagerPrototype" bean="tracciatoCoperturaMondialpolManager"/>
</bean>

But still not working, the method continue to return null. What is going wrong? I'm using spring mvc 4.1 btw. Thanks for your answers.

Anthony :

The modifier of Lookup method must be protected or less restrictive

<public|protected> [abstract] <return-type> theMethodName(no-arguments);

Did you try to use this signature of method?

From official doc

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=308507&siteId=1