Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

67 changes: 55 additions & 12 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,44 +1,87 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>
<artifactId>SpringBootMavenExample</artifactId>

<groupId>com.javabycode.springboot</groupId>
<artifactId>springboot-maven-example</artifactId>
<version>1.0.1</version>
<packaging>jar</packaging>

<name>SpringBootMavenExample</name>
<description>SpringBootMavenExample</description>
<packaging>war</packaging>
<description>Spring Boot Hello World Example (Java 17, Spring Boot 3.3.4)</description>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.5.RELEASE</version>
<version>3.3.4</version>
<relativePath/>
</parent>

<properties>
<java.version>1.7</java.version>
<java.version>17</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<!-- Web starter -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<!-- Thymeleaf template engine (for /hello view) -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>

<!-- Optional: expose app info and health -->
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

<!-- Unit testing -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<scm>
<connection>scm:git:https://github.com/vishnu/springboot-maven-example.git</connection>
<developerConnection>scm:git:ssh://git@github.com:vishnu/springboot-maven-example.git</developerConnection>
<url>https://github.com/vishnu/springboot-maven-example</url>
</scm>

<build>
<plugins>
<!-- Standard Spring Boot plugin -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>

<!-- Optional: adds build metadata -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

</project>
17 changes: 10 additions & 7 deletions src/main/java/com/javabycode/springboot/HelloWorldController.java
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
package com.javabycode.springboot;


import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
public class HelloWorldController {
@RequestMapping("/hello")
public String hello(Model model, @RequestParam(value="name", required=false, defaultValue="World") String name) {

String message="You just create Spring Boot Example successfully";

@GetMapping("/hello")
public String hello(Model model,
@RequestParam(value = "name", required = false, defaultValue = "World") String name) {

String message = "You just created a Spring Boot Example successfully!";
model.addAttribute("name", name);
model.addAttribute("message", message);
return "hello";

return "hello"; // Points to hello.html (Thymeleaf)
}
}
14 changes: 4 additions & 10 deletions src/main/java/com/javabycode/springboot/MyWebApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,13 @@

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.web.SpringBootServletInitializer;


@SpringBootApplication
public class MyWebApplication extends SpringBootServletInitializer{
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(MyWebApplication.class);
}

public static void main(String[] args) throws Exception {
public class MyWebApplication {
public static void main(String[] args) {
SpringApplication.run(MyWebApplication.class, args);
System.out.println("✅ Spring Boot Application started successfully!");

}
}

2 changes: 2 additions & 0 deletions target/classes/application.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
spring.mvc.view.prefix: /
spring.mvc.view.suffix: .jsp
Binary file not shown.
Binary file not shown.
3 changes: 3 additions & 0 deletions target/maven-archiver/pom.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
artifactId=springboot-maven-example
groupId=com.javabycode.springboot
version=1.0.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
com\javabycode\springboot\HelloWorldController.class
com\javabycode\springboot\MyWebApplication.class
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
C:\Users\Vishnu\Desktop\Node JS\spring-boot-maven-example-helloworld\src\main\java\com\javabycode\springboot\HelloWorldController.java
C:\Users\Vishnu\Desktop\Node JS\spring-boot-maven-example-helloworld\src\main\java\com\javabycode\springboot\MyWebApplication.java
Binary file added target/springboot-maven-example-1.0.1.jar
Binary file not shown.
Binary file not shown.