Tag: backend
All the articles with the tag "backend".
-
Spring Boot #1 — First Run (bootRun · Embedded Tomcat) · @RestController · Getting a Feel for Dependency Injection
Wrapping up Java #3 (Exceptions · Concurrency · Gradle), I'm starting Spring Boot today. I pulled a hello-spring project from Spring Initializr and ran it with ./gradlew bootRun — the terminal looks stuck at "80% EXECUTING" but the server is actually already up on port 8080 (the Gradle daemon is holding onto the process, which is why the progress bar shows that way). Spring Boot has Tomcat embedded, so port 8080 comes up without installing a separate WAS. With no endpoint defined, hitting 8080 gives an error page — you need @RestController + @GetMapping to specify a path before a response is attached. Then, getting a feel for dependency injection (DI) — the reason a service gets injected into a controller without the controller ever calling new on it is that Spring creates one instance of the @Service class at startup, keeps it as a bean, and automatically plugs it into the controller's constructor. The interface sense I've been building since Java #1 — the contractual nature of using something handed to you without knowing its implementation — shows up here in an automated form within Spring. This is exactly why coupling goes down and testing gets easier.
-
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.
-
Java Study #1 — First Java Run · Syntax Overview · OOP Basics (Classes · Encapsulation · Inheritance · Interfaces)
Starting Java study to fill in my lacking backend and production experience. In one day, I went from installing Java to covering the switch statement's -> arrow syntax, for-each, the need for double casting in integer division, the public class file rule, encapsulation with private + getter, the difference with and without static, the @Override annotation, and connecting interfaces with implements. Having Python / C++ experience, many concepts were already familiar.