Back Forum Reply New

How to get static final fields as bean

Hello all.

I have application that consist of several modules. In core I have bean A. In another module I want to use bean A but I need configure it. This is a standart situation in enterprise development.

I browse through reference doc and found quot;3.2.3.2. Bean creation via static factory methodquot;. I need somethig similar except that I don't want to create static method - i am using static final fields. Actually it is an interface which contains constants and I don't want to convert it into class

Code:
public interface WorkflowConstants #123;   public static final String#91;#93; IMPORT_WORKFLOWS = #123;quot;ssm-importquot;, quot;ssm-passthroughquot;#125;;   public static final String#91;#93; EXPORT_WORKFLOWS = #123;quot;ssm-exportquot;, quot;ssm-export-catalogquot;#125;;   public static final String#91;#93; ALL_WORKFLOWS = #123;quot;ssm-importquot;, quot;ssm-passthroughquot;, quot;ssm-exportquot;, quot;ssm-export-catalogquot;#125;;
#125;
I would like to cofigure bean A using this fields somethig like this

Code:
lt;property name=quot;workflowNamesquot;gt;lt;bean class=quot;com.jcatalog.ssm.workflow.WorkflowConstantsquot; factory-method=quot;ALL_WORKFLOWSquot;/gt;lt;/propertygt;
Is it possible with 1.2.1 version of Spring Framework??

In fact I would like to see in Spring some kind of expression language (like OGNL) which helps a lot in such situation.

Maybe org..beans.factory.config.FieldRetr  ievingFactoryBean could be helpful for you.

OGNL support is already targeted for a future release of Spring.

Regards,
Andreas


Originally Posted by Andreas SenftMaybe org..beans.factory.config.FieldRetr  ievingFactoryBean could be helpful for you.

Thank you very much it is exaclty what I need.
¥
Back Forum Reply New