Spring - using static final fields (constants) for bean initialization

Posted by lisak on Stack Overflow See other posts from Stack Overflow or by lisak
Published on 2010-05-24T14:47:26Z Indexed on 2010/05/24 14:51 UTC
Read the original article Hit count: 268

Filed under:


is it possible to define a bean with the use of static final fields of CoreProtocolPNames class like this:

<bean id="httpParamBean" class="org.apache.http.params.HttpProtocolParamBean">
     <constructor-arg ref="httpParams"/>
     <property name="httpElementCharset" value="CoreProtocolPNames.HTTP_ELEMENT_CHARSET" />
     <property name="version" value="CoreProtocolPNames.PROTOCOL_VERSION">

public interface CoreProtocolPNames {

    public static final String PROTOCOL_VERSION = "http.protocol.version"; 

    public static final String HTTP_ELEMENT_CHARSET = "http.protocol.element-charset"; 

If it is possible, what is the best way of doing this ?

© Stack Overflow or respective owner

Related posts about spring

Related posts about definition