SpringMVC简介

01-SpringMVC的简介
image1

02-入门案例

02.1 配置相关依赖
image2

02.2 配置SpringMVC控制器类 即Controller层
image3

02.3 写好SpringMVC配置类,设定其对应的bean
image4

02.4 装载SpringMVC的bean类进Spring的IOC容器

image5

注解:

  1. @Controller———>设定SpringMVC的核心控制器的bean

  2. @RequestMapping()—>请求访问的路径

3. @ResponseBody()—>
image6

AnnotationConfigWebApplicationContext

image7

03-入门案例解析
image8

04-SpringMVC的bean加载控制
image9

如何让Spring不去加载SringMVC的bean(SpringMVC自己管理其bean)
1.在SpringConfig的@ComponentScan()注解中精确扫描Service/Dao包,
但是不扫Controller的包
2.在@ComponentScan()注解中加上
excludeFilters=@ComponentScan.Filter(TYPE=,classes=TYPE.class)

image10

@ComponentScan
image11

image12

简化
image13