开发者

How to convert any datatype other than string to String in mule-config.xml

For example in mule-config.xml file, if we have

---Start

spring:bean id="objPool" class="org.apache.commons.pool.impl.GenericObjectPool"

spring:property name="whenExhaustedAction" value="#

{org.apache.commons.pool.impl.GenericObjectPool.WHEN_EXHAUSTED_GROW}"

---End

Here, WHEN_EXHAUSTED_GROW is public static final byte and its value is 2.

Now when I do mule -config mule-config.xml, I get following error

Error:

org.mule.api.lifecycle.InitialisationException: Initialisation Failure: Error creating bean with name 'videoRequestSAXParserObjectPool' defined in URL [file:/home/joshlabs/codebase/collider-server-tidal/src/main/resources/mule-config-pingback.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type [java.lang.String] to required type [byte] for property 'whenExhaustedAction'; nested exception is java.lang.开发者_如何学JAVANumberFormatException: For input string: "{org.apache.commons.pool.impl.GenericObjectPool.WHEN_EXHAUSTED_GROW}"

Please help me how can I convert "byte" datatype to "String" datatype.

Thanks, Prince


Mule 2.1.2 depends on Spring 2.5.6, which doesn't support Spring Expression Language (SpEL). In Spring 2, you'll need to use util:constant to read the WHEN_EXHAUSTED_GROW value and inject it.


You have an SpEL problem, not a Mule one.

When you type a class name, SpEL doesn't know if that is a class or not. So it's returning "org.apache.commons.pool.impl.GenericObjectPool.WHEN_EXHAUSTED_GROW" as a string. You should use the T operator.

Try this :

#{T(org.apache.commons.pool.impl.GenericObjectPool).WHEN_EXHAUSTED_GROW}"
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜