Results 1 to 2 of 2

Thread: UnsatisfiedDependencyException

Hybrid View

  1. #1
    Join Date
    Aug 2007
    Posts
    1

    Default 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. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,625

    Default

    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).
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •