injecting values from an enum into a spring bean

Posted on Saturday, June 12, 2010

0


Recently we had a requirement to inject an enum into a spring bean. To inject all the values of the enum we did the following


<bean id="elementTypes" factory-method="values">

and the following attribute in the spring bean was defined as


public class CompanyScoreMasterStatement implements CompanyEventStatement {

 private EPStatement statement;

 @Resource
 private ScoreElementType[] elementTypes;
About these ads
Posted in: Java, Tip