d");
objB.getMessage();
}
}
以下是prototype作用域所需的Beans.xml配置文件的内容:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<bean id="helloWorld" class="com.tutorialspoint.HelloWorld" scope="prototype">
</bean>
</beans>
当您完成创建源代码和bean配置文件后,让我们运行应用程序。如果您的应用程序一切正常,它将打印以下消息:
Your Message : I'm object A
Your Message : null
最后
为了方便其他设备和平台的小伙伴观看往期文章,链接奉上:
公众号搜索Let us Coding
,知乎,开源中国,CSDN,思否,掘金,InfoQ,简书,博客园,慕课,51CTO,helloworld,腾讯开发者社区,阿里开发者社区
看完如果觉得有帮助,欢迎点赞、收藏和关注