forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request quarkusio#12579 from aureamunoz/spring-web-example…
…-12559
- Loading branch information
Showing
15 changed files
with
316 additions
and
0 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
...in/resources/codestarts/quarkus/core/examples/spring-web-example/base/README.md
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,5 @@ | ||
# Spring Web | ||
|
||
Guide: https://quarkus.io/guides/spring-web | ||
|
||
|
154 changes: 154 additions & 0 deletions
154
...amples/spring-web-example/base/src/main/resources/META-INF/resources/spring.tpl.qute.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 |
---|---|---|
@@ -0,0 +1,154 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>{project.artifact-id} - {project.version}</title> | ||
<style> | ||
h1, h2, h3, h4, h5, h6 { | ||
margin-bottom: 0.5rem; | ||
font-weight: 400; | ||
line-height: 1.5; | ||
} | ||
|
||
h1 { | ||
font-size: 2.5rem; | ||
} | ||
|
||
h2 { | ||
font-size: 2rem | ||
} | ||
|
||
h3 { | ||
font-size: 1.75rem | ||
} | ||
|
||
h4 { | ||
font-size: 1.5rem | ||
} | ||
|
||
h5 { | ||
font-size: 1.25rem | ||
} | ||
|
||
h6 { | ||
font-size: 1rem | ||
} | ||
|
||
.lead { | ||
font-weight: 300; | ||
font-size: 2rem; | ||
} | ||
|
||
.banner { | ||
font-size: 2.7rem; | ||
margin: 0; | ||
padding: 2rem 1rem; | ||
background-color: #00A1E2; | ||
color: white; | ||
} | ||
|
||
body { | ||
margin: 0; | ||
font-family: -apple-system, system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; | ||
} | ||
|
||
code { | ||
font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; | ||
font-size: 87.5%; | ||
color: #e83e8c; | ||
word-break: break-word; | ||
} | ||
|
||
.left-column { | ||
padding: .75rem; | ||
max-width: 75%; | ||
min-width: 55%; | ||
} | ||
|
||
.right-column { | ||
padding: .75rem; | ||
max-width: 25%; | ||
} | ||
|
||
.container { | ||
display: flex; | ||
width: 100%; | ||
} | ||
|
||
li { | ||
margin: 0.75rem; | ||
} | ||
|
||
.right-section { | ||
margin-left: 1rem; | ||
padding-left: 0.5rem; | ||
} | ||
|
||
.right-section h3 { | ||
padding-top: 0; | ||
font-weight: 200; | ||
} | ||
|
||
.right-section ul { | ||
border-left: 0.3rem solid #00A1E2; | ||
list-style-type: none; | ||
padding-left: 0; | ||
} | ||
|
||
</style> | ||
</head> | ||
<body> | ||
|
||
<div class="banner lead"> | ||
Your new Cloud-Native application is ready! | ||
</div> | ||
|
||
<div class="container"> | ||
<div class="left-column"> | ||
<p class="lead"> Congratulations, you have created a new Quarkus application with Spring Web.</p> | ||
|
||
<h2>Why do you see this?</h2> | ||
|
||
<p>This page is served by Quarkus. The source is in | ||
<code>src/main/resources/META-INF/resources/index.html</code>.</p> | ||
|
||
<h2>What can I do from here?</h2> | ||
|
||
<p>If not already done, run the application in <em>dev mode</em> using: <code>{buildtool.cmd.dev}</code>. | ||
</p> | ||
<ul> | ||
<li>Open the example <a href="{resource.path}" target="_blank">"/hello"</a> endpoint</li> | ||
<li>Add REST resources, Servlets, functions and other services in <code>{language.dir.code}</code>.</li> | ||
<li>Your static assets are located in <code>src/main/resources/META-INF/resources</code>.</li> | ||
<li>Configure your application in <code>src/main/resources/{config.file-name}</code>. | ||
</li> | ||
</ul> | ||
|
||
<h2>Do you like Quarkus?</h2> | ||
<p>Go give it a star on <a href="https://github.com/quarkusio/quarkus">GitHub</a>.</p> | ||
|
||
<h2>How do I get rid of this page?</h2> | ||
<p>Just delete the <code>src/main/resources/META-INF/resources/index.html</code> file.</p> | ||
</div> | ||
<div class="right-column"> | ||
<div class="right-section"> | ||
<h3>Application</h3> | ||
<ul> | ||
<li>GroupId: {project.group-id}</li> | ||
<li>ArtifactId: {project.artifact-id}</li> | ||
<li>Version: {project.version}</li> | ||
<li>Quarkus Version: {quarkus.version}</li> | ||
</ul> | ||
</div> | ||
<div class="right-section"> | ||
<h3>Next steps</h3> | ||
<ul> | ||
<li><a href="{buildtool.guide}" target="_blank">Setup your IDE</a></li> | ||
<li><a href="https://quarkus.io/guides/getting-started.html" target="_blank">Getting started</a></li> | ||
<li><a href="https://quarkus.io" target="_blank">Quarkus Web Site</a></li> | ||
</ul> | ||
</div> | ||
</div> | ||
</div> | ||
</body> | ||
</html> |
16 changes: 16 additions & 0 deletions
16
...json/src/main/resources/codestarts/quarkus/core/examples/spring-web-example/codestart.yml
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,16 @@ | ||
name: spring-web-example | ||
ref: spring-web | ||
type: code | ||
tags: example | ||
language: | ||
base: | ||
data: | ||
resource: | ||
class-name: ExampleController | ||
path: "/springweb/hello" | ||
response: "hello" | ||
package-name: org.acme.spring.web | ||
dependencies: | ||
- io.quarkus:quarkus-spring-web | ||
test-dependencies: | ||
- io.rest-assured:rest-assured |
15 changes: 15 additions & 0 deletions
15
...ing-web-example/java/src/main/java/{package-name.dir}/{resource.class-name}.tpl.qute.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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package {package-name}; | ||
|
||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequestMapping("{resource.path}") | ||
public class {resource.class-name} { | ||
|
||
@GetMapping | ||
public String hello() { | ||
return "{resource.response}"; | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
.../java/src/native-test/java/{package-name.dir}/Native{resource.class-name}IT.tpl.qute.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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package {package-name}; | ||
|
||
import io.quarkus.test.junit.NativeImageTest; | ||
|
||
@NativeImageTest | ||
public class Native{resource.class-name}IT extends {resource.class-name}Test { | ||
|
||
// Execute the same tests but in native mode. | ||
} |
21 changes: 21 additions & 0 deletions
21
...web-example/java/src/test/java/{package-name.dir}/{resource.class-name}Test.tpl.qute.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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package {package-name}; | ||
|
||
import io.quarkus.test.junit.QuarkusTest; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static io.restassured.RestAssured.given; | ||
import static org.hamcrest.CoreMatchers.is; | ||
|
||
@QuarkusTest | ||
public class {resource.class-name}Test { | ||
|
||
@Test | ||
public void testHelloEndpoint() { | ||
given() | ||
.when().get("{resource.path}") | ||
.then() | ||
.statusCode(200) | ||
.body(is("{resource.response}")); | ||
} | ||
|
||
} |
14 changes: 14 additions & 0 deletions
14
...g-web-example/kotlin/src/main/kotlin/{package-name.dir}/{resource.class-name}.tpl.qute.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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package {package-name} | ||
|
||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
|
||
@RestController | ||
@RequestMapping("{resource.path}") | ||
class {resource.class-name} { | ||
|
||
@GetMapping | ||
fun hello() = "{resource.response}" | ||
} |
6 changes: 6 additions & 0 deletions
6
...otlin/src/native-test/kotlin/{package-name.dir}/Native{resource.class-name}IT.tpl.qute.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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package {package-name} | ||
|
||
import io.quarkus.test.junit.NativeImageTest | ||
|
||
@NativeImageTest | ||
class Native{resource.class-name}IT : {resource.class-name}Test() |
20 changes: 20 additions & 0 deletions
20
...b-example/kotlin/src/test/kotlin/{package-name.dir}/{resource.class-name}Test.tpl.qute.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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package {package-name} | ||
|
||
import io.quarkus.test.junit.QuarkusTest | ||
import io.restassured.RestAssured.given | ||
import org.hamcrest.CoreMatchers.`is` | ||
import org.junit.jupiter.api.Test | ||
|
||
@QuarkusTest | ||
class {resource.class-name}Test { | ||
|
||
@Test | ||
fun testHelloEndpoint() { | ||
given() | ||
.`when`().get("{resource.path}") | ||
.then() | ||
.statusCode(200) | ||
.body(`is`("{resource.response}")) | ||
} | ||
|
||
} |
12 changes: 12 additions & 0 deletions
12
...-web-example/scala/src/main/scala/{package-name.dir}/{resource.class-name}.tpl.qute.scala
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,12 @@ | ||
package {package-name}; | ||
|
||
import org.springframework.web.bind.annotation.\{GetMapping, RequestMapping, RestController} | ||
|
||
|
||
@RestController | ||
@RequestMapping(Array[String]("{resource.path}")) | ||
class {resource.class-name} { | ||
|
||
@GetMapping | ||
def hello() = "{resource.response}" | ||
} |
6 changes: 6 additions & 0 deletions
6
...ala/src/native-test/scala/{package-name.dir}/Native{resource.class-name}IT.tpl.qute.scala
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,6 @@ | ||
package {package-name} | ||
|
||
import io.quarkus.test.junit.NativeImageTest | ||
|
||
@NativeImageTest | ||
class Native{resource.class-name}IT extends {resource.class-name}Test |
20 changes: 20 additions & 0 deletions
20
...-example/scala/src/test/scala/{package-name.dir}/{resource.class-name}Test.tpl.qute.scala
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,20 @@ | ||
package {package-name} | ||
|
||
import io.quarkus.test.junit.QuarkusTest | ||
import io.restassured.RestAssured.given | ||
import org.hamcrest.CoreMatchers.`is` | ||
import org.junit.jupiter.api.Test | ||
|
||
@QuarkusTest | ||
class {resource.class-name}Test { | ||
|
||
@Test | ||
def testHelloEndpoint() = { | ||
given() | ||
.`when`().get("{resource.path}") | ||
.then() | ||
.statusCode(200) | ||
.body(`is`("{resource.response}")) | ||
} | ||
|
||
} |
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 |
---|---|---|
|
@@ -8,3 +8,4 @@ metadata: | |
categories: | ||
- "compatibility" | ||
status: "preview" | ||
codestart: "spring-web" |
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