上一页 1 ··· 25 26 27 28 29 30 31 32 33 ··· 47 下一页
摘要: <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <g 阅读全文
posted @ 2022-09-27 22:25 iTao0128 阅读(158) 评论(0) 推荐(0)
摘要: 页面提交的请求数据(get,post)都可以和对象属性进行绑定 @PostMapping("/saveUser") public Person saveUser(Person person){ return person; } 阅读全文
posted @ 2022-09-25 22:28 iTao0128 阅读(21) 评论(0) 推荐(0)
摘要: Map<String,Object> map、Model model、HttpServletRequest request都是可以给request域中放数据,再用request.getAttribute取数据 package com.java.boot.controller; import org. 阅读全文
posted @ 2022-09-25 21:11 iTao0128 阅读(178) 评论(0) 推荐(0)
摘要: 路径变量@PathVariable ①获取指定路径变量: @GetMapping("/car/{id}/owner/{userName}") public Map<String,Object> getCar(@PathVariable("id") int id, @PathVariable("use 阅读全文
posted @ 2022-09-25 14:02 iTao0128 阅读(136) 评论(0) 推荐(0)
摘要: 欢迎页 将index.html放入默认的静态资源路径下,会默认访问。 访问路径:http://localhost:8080/ 如下设置了项目的根访问路径,则欢迎页访问需使用:http://localhost:8080/my/ spring:# mvc:# static-path-pattern: / 阅读全文
posted @ 2022-09-24 22:50 iTao0128 阅读(57) 评论(0) 推荐(0)
摘要: 默认静态资源目录 类路径下:/static、/public、/resources、/META-INF/resources 以下路径下静态资源可直接访问,如http://localhost:8080/hu4.jpeg 原理:静态映射/** 请求进来,先看controller能不能处理,不能处理的所有请 阅读全文
posted @ 2022-09-21 22:46 iTao0128 阅读(129) 评论(0) 推荐(0)
摘要: package com.java.boot.config; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import org.springframework.boot.c 阅读全文
posted @ 2022-09-20 21:55 iTao0128 阅读(38) 评论(0) 推荐(0)
摘要: import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.stereotype.Component; @Component//组件加入容器中 @Conf 阅读全文
posted @ 2022-09-19 22:41 iTao0128 阅读(32) 评论(0) 推荐(0)
摘要: 条件装配:满足Conditional指定的条件,则进行组件注入 @Configuration//告诉springboot这是一个配置类 public class MyConfig { @Bean("tom") public Stu stu01(){ return new Stu("汤姆"); } @ 阅读全文
posted @ 2022-09-18 22:54 iTao0128 阅读(40) 评论(0) 推荐(0)
摘要: import boot.bean.Stu; import boot.bean.User; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configu 阅读全文
posted @ 2022-09-18 17:16 iTao0128 阅读(33) 评论(0) 推荐(0)
上一页 1 ··· 25 26 27 28 29 30 31 32 33 ··· 47 下一页