Tag: 예외처리
All the articles with the tag "예외처리".
-
Spring Boot #2 — CRUD with REST API · Layered Architecture · Global Exception Handler
Following Spring Boot #1 (first run · DI), #2 covers CRUD with REST API. Starting from the definition that REST is a combination of URL + HTTP method (GET/POST/PUT/DELETE), I completed todos CRUD by attaching @GetMapping · @PostMapping · @PutMapping · @DeleteMapping to the controller. I organized curl options (-X method · -H format · -d data) and verified the flow with a 5-step curl sequence (create → list all → update → delete → final check). Since the controller was holding all the logic, I split it into a service → layered architecture (Controller = request/response / Service = logic / Repository = storage). For exception handling: custom exception → 404 response, and with a Global Exception Handler in place, the controller just throws while the handler takes care of the response mapping — extending into practice the "throw forces propagation" contract I learned in the Java #3 post. Two trial-and-error incidents (trying to start the server without a referenced class present · writing package code before adding the library) got folded into my study guidelines to prevent recurrence.
-
Java Study #3 — Exception Handling · Concurrency · record · Modern Java · Gradle
Wrapping up the Java syntax sweep. Understood that exception handling isn't about debugging convenience — it's a safeguard so backend servers don't die in production. The difference between print vs throw — print doesn't convey failure to the caller, but exceptions force propagation. Concurrency with ExecutorService · newFixedThreadPool — 3 seconds sequential → 1 second parallel (measured 3008ms → 1006ms). record auto-generates fields, constructor, accessors, toString, equals, hashCode — a perfect fit for pure data containers like RainDataDTO from a rain gauge data logger. Also covered Modern Java features like var/switch arrows/text blocks. Finally, Gradle — once you have hundreds of files, compiling one by one with java is impossible, and it also auto-fetches external libraries. build.gradle is the core config file.