- protected Object getBeanInstance() {\r
- Object obj = getContext().getBean(bean);\r
-\r
- BeanWrapper wrapper = new BeanWrapperImpl(obj);\r
- for (OverrideArg override : overrides) {\r
- wrapper.setPropertyValue(override.getName(), override.getObject());\r
+ /**\r
+ * Retrieve the instance of the bean. <b>The value is cached.</b>\r
+ */\r
+ public Object getBeanInstance() {\r
+ if (beanInstance == null) {\r
+ beanInstance = getContext().getBean(bean);\r
+\r
+ BeanWrapper wrapper = new BeanWrapperImpl(beanInstance);\r
+ for (OverrideArg override : overrides) {\r
+ wrapper.setPropertyValue(override.getName(), override\r
+ .getObject());\r
+ }\r