All that is really needed is that you define your object as a class, not an object. This way Spring will instantiate.
@Service object UserRest extends RestHelper { @Autowired @BeanProperty val userRepository: UserRepository = null; ..... } <beans> ..... <bean id="userRest" class="com.abc.rest.UserRest" > <property name="userRepository" ref="userRepository"/> </bean> </beans>
Changing βvalβ to βvarβ is not required (Spring uses reflection, which ignores immutability). I'm sure this @BeanProperty is also not needed (Spring will refer to the base field, reflectively).
Dave griffith
source share