Dan Markhasin
Dan Markhasin

Reputation: 792

Reference current bean with SpEL

Is there a way to reference the current instance of the object which contains the SPeL expression?

I am basically looking for something like

@Value("#{otherBean.getClassName(this.GetClass())}")

Where getClassName(Class<T> class) returns the name of the class, for example.

Upvotes: 6

Views: 2016

Answers (1)

Gary Russell
Gary Russell

Reputation: 174664

No; that is not possible; there is no way to reference the current bean (or class), you can only access beans by name.

Upvotes: 3

Related Questions