It may not be the best solution but you can set the value of name
into a System
property and get it where you need it in your class.
Setting the value somewhere in a non-spring class:
// myProperty is the name of the property
// name is the value you want to store
System.setProperty("myProperty",name);
Getting inside your class:
// Caution: the name of the property must be the same as it was when it was set
String name = System.getProperty("myProperty);
The getting method can be called in the constructor of your bean class as it is marked as @Lazy
.
EDIT:
Another way is to create a setter for the field name
and set its value when you need it.