Spring的几大模块
核心模块 bean /core /context /spel。
<bean id="id" class="com.spring.UserServiceImpl">
<property name="userName" value="zhangsan" />
<property name="age" value="19" />
....
</bean>
Class targetClass = Class.forName("com.spring.UserServiceImpl");
Object bean = targetClass.newInstance();
String setName = "set"+"UserName";
Method setMethod = targetClass.getMethod(setName,zhangsan.getClass());
setMethod.invoke(bean,zhangsan);
<bean id="id" class="com.spring.User">
<constructor index="0" value="zhangsan" />
<constructor index="1" value="20" />
....
</bean>
Class targetClass = Class.forName("com.spring.User");
Constructor targetCtr = targetClass.getConstructor(zhangsan.getClass(),20.getClass());
Object bean = targetCtr.newInstance("zhangsan","20");