The easiest way is to use Spring Expression Language:
<constructor-arg value="#{ T(ChallengeScheme).HTTP_BASIC }" />
Note that you need a full class name in T(...)
.
Pergunta
In the application context XML file, how do you set a constructor argument to a static class member?
For example, I am using Restlet and one of Restlet's classes called ChallengeAuthenticator receives a challenge scheme member variable.
// Normal Initialization
ChallengeAuthenticator challengeAuthenticator = new ChallengeAuthenticator(
null, ChallengeScheme.HTTP_BASIC, "WSRealm");
I want to have this in the application context if possible. To something like this:
<bean id="challengeAuthenticator" class="org.restlet.security.ChallengeAuthenticator">
<!-- Not meant to be String for value just trying to make it easier to reader to interpret my question -->
<constructor-arg value="ChallengeScheme.HTTP_BASIC" />
</bean>
Solução
The easiest way is to use Spring Expression Language:
<constructor-arg value="#{ T(ChallengeScheme).HTTP_BASIC }" />
Note that you need a full class name in T(...)
.