随笔分类 -  spring

摘要:war包代表一个应用 web.xml是tomcat和spring间的桥梁,是tomcat构建spring运行环境的说明书 It is a web application deployment descriptor file, contains detail description about web 阅读全文
posted @ 2019-12-31 17:47 zzfx 阅读(250) 评论(0) 推荐(0) 编辑
摘要:一个Context对应一个web应用,而一个web应用应该有一个web.xml 观察StandardContext的startInternal方法 startInternal() -> fireLifecycleEvent(Lifecycle.CONFIGURE_START_EVENT, null) 阅读全文
posted @ 2019-12-31 17:23 zzfx 阅读(505) 评论(0) 推荐(0) 编辑
摘要:一、ServletContext Defines a set of methods that a servlet uses to communicate with its servlet container, for example, to get the MIME type of a file, 阅读全文
posted @ 2019-12-31 16:14 zzfx 阅读(486) 评论(0) 推荐(0) 编辑
摘要:既然,ServletContext是由Servlet容器初始化的,那spring的ContextLoaderListener又做了什么初始化呢? 1、servlet容器启动,为应用创建一个“全局上下文环境”:ServletContext 2、容器调用web.xml中配置的contextLoaderL 阅读全文
posted @ 2019-12-31 15:52 zzfx 阅读(326) 评论(0) 推荐(0) 编辑
摘要:In the Web MVC framework, each DispatcherServlet has its own WebApplicationContext, which inherits all the beans already defined in the rootWebApplica 阅读全文
posted @ 2019-12-31 14:56 zzfx 阅读(622) 评论(0) 推荐(0) 编辑
摘要:viewandmodel中的数据最终序列化后写入response; 没有的话则不做处理mv != null; @RequestMapping("/login") public void login(User user, HttpServletResponse response){ response. 阅读全文
posted @ 2019-12-30 19:23 zzfx 阅读(1315) 评论(0) 推荐(0) 编辑
摘要:/** * Holder for both Model and View in the web MVC framework. * Note that these are entirely distinct. This class merely holds * both to make it poss 阅读全文
posted @ 2019-12-30 18:58 zzfx 阅读(149) 评论(0) 推荐(0) 编辑
摘要:When RESTful Web Service is developed using Spring MVC, the application is configured as given below. Among these, implementation is necessary for the 阅读全文
posted @ 2019-12-30 16:42 zzfx 阅读(401) 评论(0) 推荐(0) 编辑
摘要:@RequestMapping 和 @GetMapping @PostMapping 区别 @GetMapping是一个组合注解,是@RequestMapping(method = RequestMethod.GET)的缩写。 @PostMapping是一个组合注解,是@RequestMapping 阅读全文
posted @ 2019-12-26 16:43 zzfx 阅读(273) 评论(0) 推荐(0) 编辑
摘要:Conceptually, calling a method on a transactional proxy looks like this…​ Conceptually, calling a method on a transactional proxy looks like this…​ ht 阅读全文
posted @ 2019-12-25 18:12 zzfx 阅读(242) 评论(0) 推荐(0) 编辑
摘要:要想很好理解这三个上下文的关系,需要先熟悉spring是怎样在web容器中启动起来的。spring的启动过程其实就是其IoC容器的启动过程,对于web程序,IoC容器启动过程即是建立上下文的过程。 spring的启动过程: 首先,对于一个web应用,其部署在web容器中,web容器提供其一个全局的上 阅读全文
posted @ 2019-12-25 11:04 zzfx 阅读(802) 评论(0) 推荐(0) 编辑
摘要:从图中可以看出:ContextLoaderListener初始化的上下文加载的Bean是对于整个应用程序共享的,不管是使用什么表现层技术,一般如DAO层、Service层Bean;DispatcherServlet初始化的上下文加载的Bean是只对Spring Web MVC有效的Bean,如Con 阅读全文
posted @ 2019-12-24 17:36 zzfx 阅读(247) 评论(0) 推荐(0) 编辑
摘要:非常重要】 组件扫描(Component-Scan) 通过配置组件扫描,可以使得spring自动扫描package,而不必在spring的配置文件中逐一声明各个<bean> 在配置组件扫描时,指定的包是“根包”,即例如指定了cn.tedu.spring,spring不只会扫描这个包,还会扫描它的各个 阅读全文
posted @ 2019-12-20 18:12 zzfx 阅读(1795) 评论(0) 推荐(0) 编辑
摘要:You can see the following illustration to better understand the lifecycle of the Servlet. When the request of users to Servlet, the servlet will call 阅读全文
posted @ 2019-12-17 16:41 zzfx 阅读(408) 评论(0) 推荐(0) 编辑
摘要:核心容器包括了:Beans、Core、Context、SpEL 1. core和beans模块提供了整个框架最基础的部分,包括了IoC(控制反转)和Dependency Injection(依赖注入)。 2. Context建立在Core和Beans模块提供的基础之上:他提供了框架式访问对象的方式 阅读全文
posted @ 2019-10-21 11:45 zzfx 阅读(388) 评论(0) 推荐(0) 编辑
摘要:Java Servlet API是Servlet容器和Servlet之间的接U,它定义了Servlet的各种方法, 还定义了Servlet容器传送给Servlet的对象类,其中最重要的是请求对象ServletRequest和 响应对象ServletResponseo这两个对象都是由Servlet容器 阅读全文
posted @ 2019-09-16 23:00 zzfx 阅读(1259) 评论(1) 推荐(0) 编辑
摘要:Spring核心思想,IoC与DI详解(如果还不明白,放弃java吧) 1.IoC是什么? IoC(Inversion of Control)控制反转,IoC是一种新的Java编程模式,目前很多轻量级容器都在广泛使用的模式。 2.IoC解决了什么问题? 在IoC出现以前,组件之间的协调关系是由程序内 阅读全文
posted @ 2019-08-28 17:33 zzfx 阅读(690) 评论(0) 推荐(0) 编辑
摘要:https://www.cnblogs.com/smileLuckBoy/p/5801678.html 近期在捯饬spring的注解,现将遇到的问题记录下来,以供遇到同样问题的童鞋解决~ 先说明下场景,代码如下: 有如下接口: public interface EmployeeService { p 阅读全文
posted @ 2019-08-19 19:16 zzfx 阅读(284) 评论(0) 推荐(0) 编辑
摘要:Spring,Spring MVC,Spring Boot 三者比较 Spring 框架就像一个家族,有众多衍生产品例如 boot、security、jpa等等。但他们的基础都是Spring 的 ioc和 aop ioc 提供了依赖注入的容器 aop ,解决了面向横切面的编程,然后在此两者的基础上实 阅读全文
posted @ 2019-07-29 21:58 zzfx 阅读(772) 评论(0) 推荐(0) 编辑
摘要:https://www.cnblogs.com/chenpi/p/5652555.html https://github.com/peterchenhdu/webbf 阅读全文
posted @ 2019-07-25 16:47 zzfx 阅读(247) 评论(0) 推荐(0) 编辑