【发布时间】:2017-03-12 10:56:10
【问题描述】:
beans.xml
<bean id="duke" class="Juggler">
<constructor-arg value="#{T(java.util.Random).nextInt(10)}"/>
</bean>
例外:
原因:org.springframework.expression.spel.SpelEvaluationException: EL1004E:(pos 20): Method call: Method nextInt(java.lang.Integer) can not be found on java.util.Random type
【问题讨论】:
-
nextInt(int)不是静态方法。您需要java.util.Random的实例才能调用nextInt(10)。
标签: java spring-el spelevaluationexception