先从这个项目里改:https://blog.csdn.net/GLOAL_COOK/article/details/112424735
配置文件:
改applicationContext.xml文件,再在test测试
1.singleton
<bean id="userDao" class="cn.itcast.dao.impl.UserDaoImpl"></bean>
不写scope就默认为singleton,也不可以不省略:
<?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/bea