Daniel Hinojosa
2008-05-22 23:45:51 UTC
org.picocontainer.injectors.AbstractInjector$AmbiguousComponentResolutionException:
null needs a 'javax.swing.JMenu' injected, but there are too many
choices to inject. These:[class gov.xyzcorp.swing.FileMenu, class
gov.xyzcorp.swing.EditMenu], refer
http://picocontainer.org/ambiguous-injectable-help.html
Here is the class that it has a problem with:
public class MyMenuBar extends JMenuBar implements Startable {
private JMenu editMenu;
private JMenu fileMenu;
@Inject
public void setFileMenu(JMenu fileMenu) {
this.fileMenu = fileMenu;
}
@Inject
public void setEditMenu(JMenu editMenu) {
this.editMenu = editMenu;
}
public void start() {
System.out.println(Thread.currentThread().getName()); //using
this determine if I need EDT
this.add(fileMenu);
this.add(editMenu);
}
public void stop() {
}
}
In my mapping I am using:
public ServiceLocator() {
parent = new
PicoBuilder().withCaching().withPropertyApplier().withLifecycle().build();
parent.addComponent("serviceLocator", this);
parent.addComponent("myFrame", MyFrame.class);
parent.addComponent("fileMenu", FileMenu.class);
parent.addComponent("editMenu", EditMenu.class);
parent.addComponent("myMenuBar", MyMenuBar.class);
parent.start();
}
I am using paranamer-1.1.1 and asm-3.1.jar in my classpath. FileMenu
and EditMenu classes are subclasses of JMenu.
Thanks everyone. ;)
Danno
--
Daniel Hinojosa
Programmer, Instructor, and Consultant
2529 Wisconsin St. NE
Albuquerque, NM 87110
dhinojosa-sRlC7LJHFRkitjMjQMKR8gC/***@public.gmane.org
http://www.evolutionnext.com
http://www.abqjug.org
(505) 363-5832
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
null needs a 'javax.swing.JMenu' injected, but there are too many
choices to inject. These:[class gov.xyzcorp.swing.FileMenu, class
gov.xyzcorp.swing.EditMenu], refer
http://picocontainer.org/ambiguous-injectable-help.html
Here is the class that it has a problem with:
public class MyMenuBar extends JMenuBar implements Startable {
private JMenu editMenu;
private JMenu fileMenu;
@Inject
public void setFileMenu(JMenu fileMenu) {
this.fileMenu = fileMenu;
}
@Inject
public void setEditMenu(JMenu editMenu) {
this.editMenu = editMenu;
}
public void start() {
System.out.println(Thread.currentThread().getName()); //using
this determine if I need EDT
this.add(fileMenu);
this.add(editMenu);
}
public void stop() {
}
}
In my mapping I am using:
public ServiceLocator() {
parent = new
PicoBuilder().withCaching().withPropertyApplier().withLifecycle().build();
parent.addComponent("serviceLocator", this);
parent.addComponent("myFrame", MyFrame.class);
parent.addComponent("fileMenu", FileMenu.class);
parent.addComponent("editMenu", EditMenu.class);
parent.addComponent("myMenuBar", MyMenuBar.class);
parent.start();
}
I am using paranamer-1.1.1 and asm-3.1.jar in my classpath. FileMenu
and EditMenu classes are subclasses of JMenu.
Thanks everyone. ;)
Danno
--
Daniel Hinojosa
Programmer, Instructor, and Consultant
2529 Wisconsin St. NE
Albuquerque, NM 87110
dhinojosa-sRlC7LJHFRkitjMjQMKR8gC/***@public.gmane.org
http://www.evolutionnext.com
http://www.abqjug.org
(505) 363-5832
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email