-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Convention Plugins for Spring Boot
- Loading branch information
Showing
13 changed files
with
64 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 16 additions & 14 deletions
30
app/src/main/java/org/example/product/app/AppServlet.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,22 @@ | ||
package org.example.product.app; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
|
||
import java.io.BufferedReader; | ||
import java.io.IOException; | ||
import java.io.PrintWriter; | ||
import javax.servlet.annotation.WebServlet; | ||
import javax.servlet.http.HttpServlet; | ||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
import java.io.InputStreamReader; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
public class AppServlet { | ||
|
||
@WebServlet("/check") | ||
public class AppServlet extends HttpServlet { | ||
public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException { | ||
res.setContentType("text/html"); | ||
PrintWriter pw = res.getWriter(); | ||
pw.println("<html><body>"); | ||
pw.println("App is running..."); | ||
pw.println("</body></html>"); | ||
pw.close(); | ||
@GetMapping("/") | ||
public String index() throws IOException { | ||
new MainModule().run(); | ||
String version = new BufferedReader( | ||
new InputStreamReader(requireNonNull(AppServlet.class.getResourceAsStream("/version.txt")))) | ||
.readLine(); | ||
return "<html><body>" + "App is running... !!!!" + "<br/>Version " + version + "</body></html>"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
package org.example.product.app; | ||
|
||
import java.io.IOException; | ||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
@SpringBootApplication | ||
public class Application { | ||
|
||
public static void main(String[] args) throws IOException { | ||
new MainModule().run(); | ||
public static void main(String[] args) { | ||
SpringApplication.run(Application.class, args); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
gradle/plugins/src/main/kotlin/org.example.gradle.component.application.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,16 @@ | ||
plugins { | ||
id("org.gradle.application") | ||
id("org.gradle.java") | ||
id("org.example.gradle.base.dependency-rules") | ||
id("org.example.gradle.base.identity") | ||
id("org.example.gradle.base.lifecycle") | ||
id("org.example.gradle.check.dependencies") | ||
id("org.example.gradle.check.format-gradle") | ||
id("org.example.gradle.check.format-java") | ||
id("org.example.gradle.feature.spring-boot") | ||
id("org.example.gradle.feature.checksum") | ||
id("org.example.gradle.feature.package-version-txt") | ||
id("org.example.gradle.feature.compile-java") | ||
id("org.example.gradle.feature.javadoc") | ||
id("org.example.gradle.feature.test") | ||
id("org.example.gradle.feature.test-end-to-end") | ||
id("org.example.gradle.feature.war") | ||
} |
3 changes: 3 additions & 0 deletions
3
gradle/plugins/src/main/kotlin/org.example.gradle.feature.package-version-txt.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
plugins { id("org.gradle.java") } | ||
|
||
tasks.processResources { from(isolated.rootProject.projectDirectory.file("gradle/version.txt")) } |
18 changes: 18 additions & 0 deletions
18
gradle/plugins/src/main/kotlin/org.example.gradle.feature.spring-boot.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
plugins { | ||
id("org.gradle.java") | ||
id("org.springframework.boot") | ||
id("org.example.gradle.base.dependency-rules") | ||
} | ||
|
||
dependencies { developmentOnly("org.springframework.boot:spring-boot-devtools") } | ||
|
||
configurations { | ||
productionRuntimeClasspath { | ||
extendsFrom(configurations["internal"]) | ||
shouldResolveConsistentlyWith(configurations["mainRuntimeClasspath"]) | ||
} | ||
developmentOnly { | ||
extendsFrom(configurations["internal"]) | ||
shouldResolveConsistentlyWith(configurations["mainRuntimeClasspath"]) | ||
} | ||
} |
19 changes: 0 additions & 19 deletions
19
gradle/plugins/src/main/kotlin/org.example.gradle.feature.war.gradle.kts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters