https://github.com/dashaun/hello-spring
https://github.com/dashaun/hello-spring
Last synced: 11 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/dashaun/hello-spring
- Owner: dashaun
- License: apache-2.0
- Created: 2025-06-15T22:11:25.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2025-06-15T22:51:54.000Z (12 months ago)
- Last Synced: 2025-10-12T12:43:26.213Z (8 months ago)
- Language: Java
- Size: 67.4 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.adoc
- License: LICENSE
Awesome Lists containing this project
README
== Basic Spring Web Application
This project contains a web service that will accept HTTP GET requests at
`http://localhost:8080/greeting`.
It will respond with a JSON representation of a greeting, as the following listing shows:
====
[source,json]
----
{"id":1,"content":"Hello, World!"}
----
====
You can customize the greeting with an optional `name` parameter in the query string, as
the following listing shows:
====
[source,text]
----
http://localhost:8080/greeting?name=User
----
====
The `name` parameter value overrides the default value of `World` and is reflected in the
response, as the following listing shows:
====
[source,json]
----
{"id":1,"content":"Hello, User!"}
----
====
=== Building and running
[source,bash]
----
./mvnw spring-boot:run
----
Then access the endpoint
[source,bash]
----
curl http://localhost:8080/greeting?name=User
----