I have an Interface IMenuItem
public interface IMenuItem {
String getIconClass();
void setIconClass(String iconClass);
String getLink();
void setLink(String link);
String getText();
void setText(String text);
}
Then I have a implementation for this interface
@Component
@Scope("prototype")
public class MenuItem implements IMenuItem {
private String iconClass;
private String link;
private String text;
public MenuItem(String iconClass, String link, String text) {
this.iconClass = iconClass;
this.link = link;
this.text = text;
}
//setters and getters
}
Is there any way to create multiple instances of MenuItem from a configuration class, using only the IMenuItem interface? with @autowired or something ? Also is it possible to autowire by specifying the arguments of the constructor ?
See Question&Answers more detail:os