java - how to auto inject multiple beans into an ArrayList property with spring and its annotation -
e.g. have array list property in action.
private arraylist<sitesbusiness> businesses;
and sitesbusiness nothing interface, , property intended contain beans implements sitesbusiness.
the question want use spring annotation mechanism auto inject beans implements sitesbusiness businesses.
any 1 can help? many thanks.
i tried use autowired on method job
@autowired public void addbusiness(sitesbusiness business) { system.out.println("sitesaction, addbusiness.di1210, business.identifier: " + business.getidentifier()); (int = 0; < this.businesses.size(); ++i) { if (globalmethods.getinstance().checkequal(this.businesses.get(i), business) || globalmethods.getinstance().checkequal(this.businesses.get(i).getidentifier(), business.getidentifier())) { return; } } this.businesses.add(business); }
unfortunately, got:
expected single matching bean found 2: accountbusiness,diarybusiness
this code should work:
@autowired private list<sitesbusiness> businesses;
Comments
Post a Comment