I have a class, being injected by guice and this class constructor invokes super, with resource loaded by class.getResource(..)
@SuppressWarnings("serial")
public class CleanAction extends AbstractAction {
private final JTable table;
private final PowderTableModel tableModel;
@Inject
public CleanAction(@Named("data") JTable table, PowderTableModel tableModel) {
super("Clean", new ImageIcon(CleanAction.class.getResource("/icons/table.png")));
this.table = table;
this.tableModel = tableModel;
}
...
}
It works fine in tests, but during guice initialization the result of CleanAction.class.getResource("icons/table.png") is null, so it fails with NullPointerException.
Is there any guice way to inject resources?