05 2018 档案
浅析Spring Aware
摘要:20180510 check 经常要用到Spring容器本身的功能资源,所以Spring容器中的Bean此时就要意识到Spring容器的存在才能调用Spring所提供的资源。我们通过Spring提供的一系列接口Spring Aware来实现具体的功能。 Spring所提供的Aware接口: 1. B 阅读全文
posted @ 2018-05-10 06:24 SkyBall 阅读(198) 评论(0) 推荐(0)
Spring MVC 注解
摘要:@RestController = @Controller + @ResponseBody @Repository 注解,需要在 XML 配置文件中启用Bean 的自动扫描功能,这可以通过<context:component-scan/>实现。 为什么 @Repository 只能标注在 DAO 类 阅读全文
posted @ 2018-05-09 05:15 SkyBall 阅读(166) 评论(0) 推荐(0)
DispatcherServlet和ContextLoaderListener是什么?
摘要:20180509 check 接收到HTTP请求后,DispatcherServlet 询问HandlerMapping (configuration files) 去请求合适的Controller。Controller接受请求后,调用合适的service方法,然后set model data,接下 阅读全文
posted @ 2018-05-09 05:12 SkyBall 阅读(193) 评论(0) 推荐(0)
Spring的配置方式
摘要:1. XML Based Configuration 如下: 实例化: 优点: 1)XML配置方式进一步降低了耦合,使得应用更加容易扩展,即使对配置文件进一步修改也不需要工程进行修改和重新编译。 2)在处理大的业务量的时候,用XML配置应该更加好一些。 缺点: 1)配置文件读取和解析需要花费一定的时 阅读全文
posted @ 2018-05-08 06:04 SkyBall 阅读(170) 评论(0) 推荐(0)
spring中的BeanFactory与ApplicationContext的作用和区别?
摘要:20180508 check 在Spring中,两个最基本最重要的包是 org.springframework.beans 和 org.springframework.context. 这两个包中的代码为Spring的反向控制 特性(也叫作依赖注射)提供了基础。 1. BeanFactory类结构体 阅读全文
posted @ 2018-05-08 05:23 SkyBall 阅读(622) 评论(0) 推荐(0)
spring 架构学习一
摘要:20180507 check spring框架的核心三个组件:Core、Context、Beans。把Bean比作一场演出中的演员的话,那Context就是这场演出的舞台背景,而Core应该就是演出的道具了。Bean包装的是Object,而Object必然有数据,如何给这些数据提供生存环境就是Con 阅读全文
posted @ 2018-05-07 16:45 SkyBall 阅读(132) 评论(0) 推荐(0)