File tree Expand file tree Collapse file tree
src/main/java/com/example Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33import org .springframework .boot .SpringApplication ;
44import org .springframework .boot .autoconfigure .SpringBootApplication ;
5- import org .springframework .stereotype .Controller ;
6- import org .springframework .ui .Model ;
75import org .springframework .web .bind .annotation .GetMapping ;
6+ import org .springframework .web .bind .annotation .RestController ;
87
98@ SpringBootApplication
10- @ Controller
119public class App {
12-
1310 public static void main (String [] args ) {
1411 SpringApplication .run (App .class , args );
1512 }
13+ }
14+
15+ @ RestController
16+ class HelloController {
1617
1718 @ GetMapping ("/" )
18- public String home (Model model ) {
19- // Pass the header text to the view
20- model .addAttribute ("header" , "Cloud Computing in Telugu" );
21- return "index" ; // Return the index.html template
19+ public String hello () {
20+ return """
21+ <!DOCTYPE html>
22+ <html>
23+ <head>
24+ <title>Spring Boot on Amazon Linux</title>
25+ <style>
26+ body {
27+ background: linear-gradient(to right, #4facfe, #00f2fe);
28+ color: white;
29+ font-family: Arial, sans-serif;
30+ display: flex;
31+ justify-content: center;
32+ align-items: center;
33+ height: 100vh;
34+ margin: 0;
35+ }
36+ h1 {
37+ background: rgba(0, 0, 0, 0.3);
38+ padding: 20px 40px;
39+ border-radius: 15px;
40+ box-shadow: 0px 4px 15px rgba(0, 0, 0, 0.2);
41+ text-align: center;
42+ }
43+ </style>
44+ </head>
45+ <body>
46+ <h1>Hello from <br>Spring Boot on Amazon Linux!</h1>
47+ </body>
48+ </html>
49+ """ ;
2250 }
2351}
You can’t perform that action at this time.
0 commit comments