Olá a todos… estou com oseguinte probleminha a ser resolvido usando o STRUTS 2.
Instancio uma Interface :
public interface GenericAction {
public String init();
public String save();
public String edit();
public String remove();
}
}
logo tento utiliza-la em minha Action:
[code]
public class PaisAction extends ActionSupport implements Preparable, GenericAction{
private PaisService paisService;
public PaisAction(PaisService paisService) {
super();
this.paisService = paisService;
}
…
}[/code]
Logo crio tambem uma interface para o service …
public interface GenericService<Reg extends Identifiable<ID>, ID extends Serializable> {
public void save(Reg row);
public List<Reg> findAll();
public List<Reg> findAllByName();
public void delete(Reg row);
public void merge(Reg row);
public Long count();
}
A referencia a ela no codigo:
public class PaisService implements GenericService<Pais, Integer>{
...
}
Segue o applicationContext.xml:
<bean id="paisService" class="service.config.PaisService" scope="prototype"/>
<bean id="paisAction" scope="prototype" class="action.config.PaisAction">
<constructor-arg ref="paisService" />
</bean>
quando tento chamar uma action da o seguinte erro:
Struts has detected an unhandled exception:
Messages:
1. Error creating bean with name 'paisAction' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Unsatisfied dependency expressed through constructor argument with index 0 of type [service.config.PaisService]: Could not convert constructor argument value of type [$Proxy17] to required type [service.config.PaisService]: Failed to convert value of type [$Proxy17] to required type [service.config.PaisService]; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [$Proxy17] to required type [service.config.PaisService]: no matching editors or conversion strategy found
2. Unable to instantiate Action, paisAction, defined for 'initPais' in namespace ''Error creating bean with name 'paisAction' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Unsatisfied dependency expressed through constructor argument with index 0 of type [service.config.PaisService]: Could not convert constructor argument value of type [$Proxy17] to required type [service.config.PaisService]: Failed to convert value of type [$Proxy17] to required type [service.config.PaisService]; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [$Proxy17] to required type [service.config.PaisService]: no matching editors or conversion strategy found
File: org/springframework/beans/factory/support/ConstructorResolver.java
Line number: 544
alguem sab como lidar com esse “problema” (ou soluçao)???
Ja tentei instanciar o metodo GenericService no construtor de PaisAction e receboi a mensagem de erro dizendo que o metodo nao pode ser instanciado por ser uma interface (logica)… mas foi soh uma tentativa sem sucesso…
At… Agradeço desde ja!