Unsatisfied dependency expressed through constructor argument with index 0 of type [java.lang.Class]
Use:
<bean id="clientDao" class="com.webapp.dao.ClientDaoImpl" parent="genericDao">
<constructor-arg >com.xxx.Client</constructor-arg >
Spring will "cast" the string to the class. Then you can remove the client bean from the XML.
Or remove this parameter from your ClientDaoImpl
, because it is useless (It can be only this type, so there is no reason to make it a parameter)
public ClientDaoImpl() {
super(com.xxx.Client.class);
}
WEB-INF/XXX-XX.xml]: Unsatisfied dependency expressed through constructor argument with index 0 of type [org.springframework.security.web.context.SecurityContextRepository]: Ambiguous constructor argument types - did you specify the correct bean references as constructor arguments?
Solution is to remove the name property from constructor argument(if it is there). Only keep the reference. It will work.
The constructor defined in the ClientDaoImpl
class expects a parameter of type Class<Client>
. But in the applicationContext.xml you set the instance client object to be passed to the constructor.
Change the constructor to receive the object and pass the class to the super, example:
public ClientDaoImpl(Client client) {
super(client.getClass());
}