首页 试题广场 > 试题详情
多选题

【C015384】在Spring配置文件applicationContext.xml有如下内容:
<bean id="user1" class="accp.User">
……
</bean>
<bean id="group1" class="accp.Group">
……
</bean>
Test.java类中有代码如下:
ApplicationContext ctx
= new ClassPathXmlApplicationContext("applicationContext*.xml");
以下说法错误的是( )。

  • A.该代码无法成功加载applicationContext.xml文件,只能加载applicationContext*.xml这个文件
  • B.ClassPathXmlApplicationContext创建时,配置的user1和group1都会被实例化
  • C.当前配置所示的所有Bean都将只生成一个实例(即单例模式)
  • D.取得id为user1的bean的代码可以是
    User user1 = ctx.getBean("user1");
提交并查看答案
下一题 上一题
Ke星伙伴们的回答/ 1个回答
关闭
关闭
QQ
交流群
邀请
好友
App
下载
意见
反馈
返回
顶部