Bean-Klasseninstanziierung im Frühjahr für eine Klasse ohne Standardkonstruktor
Ich verwende eine Drittanbieter-Bibliotheksklasse XYZ als Argument in meinem Modell. XYZ hat keinen Standardkonstruktor. Spring ist also nicht in der lage bean dafür eine fehlermeldung als zu erstellen
org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.springframework.data.mapping.model.MappingInstantiationException:
Could not instantiate bean class [org.abc.def.XYZ]: No default constructor found;nested exception is java.lang.NoSuchMethodException: org.abc.def.XYZ./<init/>()
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:681)
Was kann ich tun, um das Problem zu beheben? Ich kann XYZ keinen Standardkonstruktor hinzufügen.
In meinem Dispatcher-Servlet habe ich Folgendes hinzugefügt, aber es funktioniert immer noch nicht.
<bean name="token" class="org.abs.def.Xyx">
<constructor-arg name="arg1" value="val1"/>
<constructor-arg name="arg2" value="val2"/>
<constructor-arg name="arg3" value="val3"/>
</bean>
Vielen Dank.