Skip to content

Commit bfba308

Browse files
committed
一文搞懂如何在 Spring Boot 中正确使用 JPA
1 parent 57b2cdd commit bfba308

9 files changed

+26
-4
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
2. **[RestController VS Controller](./docs/basis/RestControllerVSController.md)**
3333
3. **[Spring Boot 异常处理](./docs/advanced/springboot-handle-exception.md)**
3434
4. [使用 spring-boot-devtools 进行热部署](./docs/basis/spring-boot-devtools.md)
35-
5. [一文搞懂如何在 Spring Boot 中正确使用 JPA]()
35+
5. **[一文搞懂如何在 Spring Boot 中正确使用 JPA](./docs/advanced/springboot-jpa.md)**
3636
6. [整合 SpringBoot+Mybatis](./docs/basis/springboot-mybatis.md)[SpirngBoot2.0+ 的 SpringBoot+Mybatis 多数据源配置](./docs/basis/springboot-mybatis-mutipledatasource.md)
3737

3838
### 进阶

docs/advanced/SpringBoot-ScheduleTasks.md

+3
Original file line numberDiff line numberDiff line change
@@ -215,3 +215,6 @@ Current Thread : task-3
215215
Fixed Delay Task : The time is now 14:27:36
216216
```
217217

218+
219+
220+
代码地址:https://github.com/Snailclimb/springboot-guide/tree/master/source-code/advanced/springboot-schedule-tast

docs/advanced/spring-bean-validation.md

+2
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,8 @@ public class PersonService {
473473

474474
使用验证组这种方式的时候一定要小心,这是一种反模式,还会造成代码逻辑性变差。
475475

476+
代码地址:https://github.com/Snailclimb/springboot-guide/tree/master/source-code/advanced/bean-validation-demo
477+
476478
## TODO
477479

478480
- [ ] JPA 数据库级别参数约束验证

docs/advanced/springboot-dubbo.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -407,4 +407,4 @@ public class DubboConsumerApplication {
407407

408408
浏览器访问 [http://localhost:8330/hello](http://localhost:8330/hello) 页面返回 Hello world,控制台输出 Hello SnailClimb,和预期一直,使用SpringBoot+Dubbo 搭建第一个简单的分布式服务实验成功!
409409

410-
410+
代码地址:https://github.com/Snailclimb/springboot-guide/tree/master/source-code/advanced/springboot-dubbo

docs/advanced/springboot-handle-exception.md

+11
Original file line numberDiff line numberDiff line change
@@ -266,3 +266,14 @@ public class ResponseStatusExceptionController {
266266
- reason :response 的消息内容
267267
- cause : 抛出的异常
268268

269+
### 总结
270+
271+
本文主要讲了 3 种捕获处理异常的方式:
272+
273+
1. 使用 **`@ControllerAdvice``**@ExceptionHandler`处理全局异常
274+
2. `@ExceptionHandler` 处理 Controller 级别的异常
275+
3. `ResponseStatusException`
276+
277+
278+
279+
代码地址:https://github.com/Snailclimb/springboot-guide/tree/master/source-code/basis/springboot-handle-exception

docs/advanced/springboot-oss.md

+1
Original file line numberDiff line numberDiff line change
@@ -512,3 +512,4 @@ JS 的内容主要是让我们上传的图片可以预览,就像我们在网
512512

513513

514514

515+
代码地址:https://github.com/Snailclimb/springboot-guide/tree/master/source-code/advanced/springboot-oss

docs/basis/springboot-mybatis.md

+1
Original file line numberDiff line numberDiff line change
@@ -335,3 +335,4 @@ public interface UserDao {
335335

336336

337337

338+
代码地址:https://github.com/Snailclimb/springboot-guide/tree/master/source-code/basis/springboot-mybatis

docs/basis/sringboot-restful-web-service.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -119,4 +119,6 @@ public class BookController {
119119

120120
### 总结
121121

122-
通过本文我们需到了使用 Lombok 来优化 Java 代码,以及一些开发 RestFul Web 服务常用的注解:`@RestController``@RequestMapping``@PostMapping``@PathVariable``@RequestParam``@RequestBody`以及和HTTP Response 有关的 `Responsity`类。关于这些知识点的用法,我在上面都有介绍到,更多用法还需要自己去查阅相关文档。代码地址:https://github.com/Snailclimb/springboot-guide/tree/master/source-code/start/hello-world(建议自己手敲一遍!!!)
122+
通过本文我们需到了使用 Lombok 来优化 Java 代码,以及一些开发 RestFul Web 服务常用的注解:`@RestController``@RequestMapping``@PostMapping``@PathVariable``@RequestParam``@RequestBody`以及和HTTP Response 有关的 `Responsity`类。关于这些知识点的用法,我在上面都有介绍到,更多用法还需要自己去查阅相关文档。
123+
124+
代码地址:https://github.com/Snailclimb/springboot-guide/tree/master/source-code/start/hello-world(建议自己手敲一遍!!!)

docs/start/springboot-hello-world.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,9 @@ server.port=8333
148148

149149
### 总结
150150

151-
通过本文我们学到了如何新建 Spring Boot 项目、SpringBoot 项目常见的项目结构分析、`@SpringBootApplication` 注解分析,最后实现了 Spring Boot 版的 "Hello World"。代码地址:https://github.com/Snailclimb/springboot-guide/tree/master/source-code/start/hello-world(建议自己手敲一遍!!!)
151+
通过本文我们学到了如何新建 Spring Boot 项目、SpringBoot 项目常见的项目结构分析、`@SpringBootApplication` 注解分析,最后实现了 Spring Boot 版的 "Hello World"。
152+
153+
代码地址: https://github.com/Snailclimb/springboot-guide/tree/master/source-code/start/hello-world(建议自己手敲一遍!!!)
152154

153155
### 代办
154156

0 commit comments

Comments
 (0)