-
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 (Kotlin variant)
- Loading branch information
Showing
13 changed files
with
69 additions
and
52 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
33 changes: 20 additions & 13 deletions
33
app/src/main/kotlin/org/example/product/app/AppServlet.kt
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,19 +1,26 @@ | ||
package org.example.product.app | ||
|
||
import javax.servlet.annotation.WebServlet | ||
import javax.servlet.http.HttpServlet | ||
import javax.servlet.http.HttpServletRequest | ||
import javax.servlet.http.HttpServletResponse | ||
import java.io.BufferedReader | ||
import java.io.InputStreamReader | ||
import java.util.* | ||
import org.springframework.web.bind.annotation.GetMapping | ||
import org.springframework.web.bind.annotation.RestController | ||
|
||
@WebServlet("/check") | ||
class AppServlet : HttpServlet() { | ||
@RestController | ||
class AppServlet { | ||
|
||
public override fun doGet(req: HttpServletRequest, res: HttpServletResponse) { | ||
res.contentType = "text/html" | ||
val pw = res.writer | ||
pw.println("<html><body>") | ||
pw.println("App is running...") | ||
pw.println("</body></html>") | ||
pw.close() | ||
@GetMapping("/") | ||
fun index(): String { | ||
MainModule().run() | ||
val version = | ||
BufferedReader( | ||
InputStreamReader( | ||
Objects.requireNonNull( | ||
AppServlet::class.java.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,5 +1,10 @@ | ||
package org.example.product.app | ||
|
||
import org.springframework.boot.SpringApplication | ||
import org.springframework.boot.autoconfigure.SpringBootApplication | ||
|
||
fun main(args: Array<String>) { | ||
MainModule().run() | ||
SpringApplication.run(Application::class.java, *args) | ||
} | ||
|
||
@SpringBootApplication open class Application |
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,17 +1,18 @@ | ||
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.check.format-kotlin") | ||
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.compile-kotlin") | ||
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