简单的spring ioc使用
- xml配置
<bean id="test" class="com.salme.blogtest.domain.Test">
<property name="id" value="20">
</property>
<property name="name" value="sqs">
</property>
<property name="innerTest" ref="innerTest">
</property>
</bean>
<bean id="innerTest" class="com.salme.blogtest.domain.InnerTest">
<property name="id" value="10">
</property>
<property name="inner" value="10">
</property>
</bean>
- javaapi配置(通过@Bean)
配置类加上
@Configuration
@ImportResource(locations= {"classpath:my/*.xml"})