spring
文章平均质量分 66
爱探索的小菜瓜
进击的菜鸟
展开
-
关于springMvc webMvc javaWeb servlet联系(网摘)
关于javaWeb Mvc模式 spring springMvc springBoot servlet jsp tomcat 三层架构 联系目录关于javaWeb Mvc模式 spring springMvc springBoot servlet jsp tomcat 三层架构 联系一.各自含义1.javaWeb2.Mvc模式3.spring4.springMvc5.springBoot6.servlet7.jsp8.tomcat9.三层架构二.相互关系1.mvc模式和三层架构2.tomcat和s原创 2022-04-23 18:43:02 · 655 阅读 · 1 评论 -
@Autowired注解 注入的是单例还是多例
前言:我在用@Autowired注解时候一直 好奇 他是每次给我的对象是同一个 还是 每次new一个新的给我 看了一些文档后发现**@Autowired是单例模式 因为它:在注入之前,对象已经实例化,**这个结论与我上篇文章单双例的结合相吻合@Scope(“prototype“) 注入单例 多例 1.StudentServiece开启多例@RestControllerpublic class StudentController { private static int demo = 0原创 2022-04-07 15:56:24 · 7345 阅读 · 0 评论 -
@Scope(“prototype“) 注入单例 多例 代码讲解
1.注入bean @Scope(“prototype”) 开启多例这里注入了一个 name为student type为Student 的bean@Servicepublic class StudentService { @Bean @Scope("prototype") public Student student(){ System.out.println("Bean被加载到容器"); return new Student("张三",23)原创 2022-04-07 14:58:37 · 3481 阅读 · 2 评论