Announcement Announcement Module
Collapse
No announcement yet.
UnsatisfiedDependencyException Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • UnsatisfiedDependencyException

    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();
       }
       ...
    }
    Code:
    MyGUI gui = new MyGUI();
    ...
    MyDialog dialog = new MyDialog(gui);
    ...
    Works fine, but with Spring ...
    Code:
    ...
    <bean id="myGUI" class="MyGUI" />
    
    <bean id="myDialog" class="MyDialog">
       <constructor-arg ref="myGUI" />
    </bean>
    ...
    ... i got:
    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

  • #2
    For some reason your class gets proxied. Post the whole configuration for a detailed solution. The not so detailed solution is to enable class proxying. (proxyClass=true).

    Comment

    Working...
    X