摘要: @GetMapping("/send") public String getmessage(HttpServletRequest request) { request.setAttribute("msg","跳转"); //设置参数 request.setAttribute("code",123); 阅读全文
posted @ 2021-06-29 12:32 YuyuFishSmile 阅读(451) 评论(0) 推荐(0)
摘要: @PathVariable() 里面的参数可以是mapping里url的值,也可以是Map,Map必须是String Map(String,String),可以通过Map提取所有的路径变量 @GetMapping("/car/{id}/owner/{username}") public Map<St 阅读全文
posted @ 2021-06-28 22:18 YuyuFishSmile 阅读(729) 评论(0) 推荐(1)
摘要: 再controller中编写同一个mapping的方法,但是对应的请求方式不同 package com.sp.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springfra 阅读全文
posted @ 2021-06-28 20:15 YuyuFishSmile 阅读(240) 评论(0) 推荐(0)
摘要: 静态资源映射 请求进来,先取找Controller看能不能处理,不能处理的所有请求又都交给静态资源处理器,如果静态资源也找不到就会报404 package com.sp.Controller; import org.springframework.web.bind.annotation.Reques 阅读全文
posted @ 2021-06-28 17:21 YuyuFishSmile 阅读(151) 评论(0) 推荐(0)
摘要: properties 通过对pojo类进行@Component放入容器中, 之后通过@ConfigurationProperties(prefix = "person") 进行容器前缀绑定,前缀为person package spring.main.spring.Bean; import lombo 阅读全文
posted @ 2021-06-28 11:41 YuyuFishSmile 阅读(229) 评论(0) 推荐(0)
摘要: Lombok 简化JavaBean的开发,可以自动生成get set tostring方法,搜索和安装Lombok <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> </dependen 阅读全文
posted @ 2021-06-28 10:24 YuyuFishSmile 阅读(94) 评论(0) 推荐(0)
摘要: 在配置文件中application.properties中添加debug = true Negative matches 为不生效的 Negative matches: ActiveMQAutoConfiguration: Did not match: - @ConditionalOnClass d 阅读全文
posted @ 2021-06-28 09:07 YuyuFishSmile 阅读(353) 评论(0) 推荐(0)
摘要: 以前的bean是通过xml文件导入,若还想通过xml可以使用@Importresource @ImportResource("classpath:文件名.xml") //导入spring的配置文件 @ConfigurationProperties 配置绑定 eg:mysql账户密码等等 contro 阅读全文
posted @ 2021-06-27 18:13 YuyuFishSmile 阅读(56) 评论(0) 推荐(0)
摘要: 当满足某个条件的时候,才进行组件的注入 常见的如下: run.containsBean用于判断是否含有某个组件 System.out.println("++++++++++++++++++++++++++++++"); boolean tom = run.containsBean("tom"); S 阅读全文
posted @ 2021-06-27 17:29 YuyuFishSmile 阅读(103) 评论(0) 推荐(0)
摘要: @Component 代表一个组件 @Controller 代表是一个控制器 @Import({User.class}) //导入组件User类型的组件 @Import({User.class, DBAppender.class}) //导入组件User类型的组件,自动创建对应的无参构造器,创建出指 阅读全文
posted @ 2021-06-27 16:53 YuyuFishSmile 阅读(222) 评论(0) 推荐(0)