My GUI shall open an modal JDialog. It works fine, when i hardcode this in Java. But when i use Spring i run into a UnsatisfiedDependencyException.
What went wrong?
Code:public class MyGUI extends JFrame { ... }Code:public class MyDialog extends JDialog { public MyDialog(java.awt.Frame parent) { super(parent, true); initComponents(); } ... }Works fine, but with Spring ...Code:MyGUI gui = new MyGUI(); ... MyDialog dialog = new MyDialog(gui); ...
... i got:Code:... <bean id="myGUI" class="MyGUI" /> <bean id="myDialog" class="MyDialog"> <constructor-arg ref="myGUI" /> </bean> ...
Code:java.lang.ExceptionInInitializerError Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'myDialog' defined in class path resource [content.xml]: Unsatisfied dependency expressed through constructor argument with index 0 of type [java.awt.Frame]: Could not convert constructor argument value [MyGUI[frame0,0,0,0x0,invalid,hidden,layout=java.awt.BorderLayout,title=,resizable,normal,defaultCloseOperation=HIDE_ON_CLOSE,rootPane=javax.swing.JRootPane[,0,0,0x0,invalid,layout=javax.swing.JRootPane$RootLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=16777673,maximumSize=,minimumSize=,preferredSize=],rootPaneCheckingEnabled=true]] to required type [java.awt.Frame]: Failed to convert value of type [$Proxy0] to required type [java.awt.Frame]; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [$Proxy0] to required type [java.awt.Frame] for property 'null': no matching editors or conversion strategy found


Reply With Quote