summaryrefslogtreecommitdiff
path: root/spring-boot/01-quick-start/src/main
diff options
context:
space:
mode:
authorKamal Wickramanayake <kamal@inbox.lk>2026-05-16 21:18:32 +0530
committerKamal Wickramanayake <kamal@inbox.lk>2026-05-16 21:18:32 +0530
commite51834c899ff20781295410961934eb06239385c (patch)
tree78f0058914063e37cbd6812d204e4f84efd0ab90 /spring-boot/01-quick-start/src/main
parentb1d598a2f02819bc127d0d3522dc7ac91b4dee65 (diff)
Added spring-boot sample applications
Diffstat (limited to 'spring-boot/01-quick-start/src/main')
-rw-r--r--spring-boot/01-quick-start/src/main/java/hello/SampleController.java31
1 files changed, 31 insertions, 0 deletions
diff --git a/spring-boot/01-quick-start/src/main/java/hello/SampleController.java b/spring-boot/01-quick-start/src/main/java/hello/SampleController.java
new file mode 100644
index 0000000..b0401aa
--- /dev/null
+++ b/spring-boot/01-quick-start/src/main/java/hello/SampleController.java
@@ -0,0 +1,31 @@
+package hello;
+
+import org.springframework.boot.*;
+import org.springframework.boot.autoconfigure.*;
+import org.springframework.stereotype.*;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ *
+ * @Controller - Indicates that an annotated class is a "Controller" (e.g. a web controller). This annotation serves as a specialization of @Component.
+ * @EnableAutoConfiguration - This annotation tells Spring Boot to "guess" how you want to configure Spring, based on the jar dependencies that you have added.
+ *
+ * @RequestMapping - Map the url pattern to a method
+ * @ResponseBody - Annotation that indicates a method return value should be bound to the web response body.
+ *
+ */
+@Controller
+@EnableAutoConfiguration
+public class SampleController {
+
+ @RequestMapping("/")
+ @ResponseBody
+ String home() {
+ return "Hello World!";
+ }
+
+ public static void main(String[] args) throws Exception {
+ SpringApplication.run(SampleController.class, args);
+ }
+}
+