use of org.springframework.beans.factory.support.GenericBeanDefinition in project spring-framework by spring-projects.
the class ScriptFactoryPostProcessor method createScriptedObjectBeanDefinition.
/**
* Create a bean definition for the scripted object, based on the given script
* definition, extracting the definition data that is relevant for the scripted
* object (that is, everything but bean class and constructor arguments).
* @param bd the full script bean definition
* @param scriptFactoryBeanName the name of the internal ScriptFactory bean
* @param scriptSource the ScriptSource for the scripted bean
* @param interfaces the interfaces that the scripted bean is supposed to implement
* @return the extracted ScriptFactory bean definition
* @see org.springframework.scripting.ScriptFactory#getScriptedObject
*/
protected BeanDefinition createScriptedObjectBeanDefinition(BeanDefinition bd, String scriptFactoryBeanName, ScriptSource scriptSource, Class<?>[] interfaces) {
GenericBeanDefinition objectBd = new GenericBeanDefinition(bd);
objectBd.setFactoryBeanName(scriptFactoryBeanName);
objectBd.setFactoryMethodName("getScriptedObject");
objectBd.getConstructorArgumentValues().clear();
objectBd.getConstructorArgumentValues().addIndexedArgumentValue(0, scriptSource);
objectBd.getConstructorArgumentValues().addIndexedArgumentValue(1, interfaces);
return objectBd;
}
use of org.springframework.beans.factory.support.GenericBeanDefinition in project spring-framework by spring-projects.
the class ApplicationContextExpressionTests method stringConcatenationWithDebugLogging.
@Test
public void stringConcatenationWithDebugLogging() {
GenericApplicationContext ac = new GenericApplicationContext();
AnnotationConfigUtils.registerAnnotationConfigProcessors(ac);
GenericBeanDefinition bd = new GenericBeanDefinition();
bd.setBeanClass(String.class);
bd.getConstructorArgumentValues().addGenericArgumentValue("test-#{ T(java.lang.System).currentTimeMillis() }");
ac.registerBeanDefinition("str", bd);
ac.refresh();
String str = ac.getBean("str", String.class);
assertTrue(str.startsWith("test-"));
}
Aggregations