复习一下狂神的Spring课程,加深一下理解,笔记参考博客:笔记链接
1.dao层、service和Controller的运用和区别
2.spring中也有单例模式(Spring默认机制)、原型模式(每次从容器中get的时候,都会产生一个新对象!),在bean中设置其作用域scope="singleton"
或scope="prototype"
。
3.使用spring注释形式注入bean,通过@Component、@Repository、 @Service和@Controller注释类,文档中说“注解如果没有指定bean的名字,默认为小写开头的类名”。例如类名是MyClass,则spring返回myClass的bean名。但是如果类名前两个字母都是大写,则返回的bean名也是大写,即类名是MYClass,bean名也是MYClass。
Spring复习
最新推荐文章于 2022-03-15 14:28:22 发布