Mukesh Kumar Saini
Mukesh Kumar Saini

Reputation: 13

Rerfering current bean in Spring using SpEL

How can i get the reference of the current bean in SpEL in xml configuration. My code is something like this

{ <bean id="circle" class="com.sample.beans.CircleType"> <property name="radius" value="35.0"></property> <property name="perimeter" value="#{2*T(java.lang.Math).PI*circle.radius}" /> <property name="area" value="#{T(java.lang.Math).PI*circle.radius^2}" /> </bean> }

I want to refer property radius while evaluating perimeter and area. How to do this. any catch ? Thanks in advance

Upvotes: 0

Views: 714

Answers (1)

Gary Russell
Gary Russell

Reputation: 174664

You can't do that because the bean is in the process of being instantiated when the expression is evaluated.

Upvotes: 1

Related Questions