initializr/initializr-service-sample/README.adoc

51 lines
1.3 KiB
Plaintext
Raw Normal View History

2019-03-20 21:11:46 +08:00
= Service sample
2019-08-18 20:07:02 +08:00
:docs: https://docs.spring.io/initializr/docs/current-SNAPSHOT/reference/html
2019-03-20 21:11:46 +08:00
This sample demonstrates how you can create your own service easily as described in the
{docs}/#create-instance[reference documentation].
== Running the service
You can start the service from the command line:
[indent=0]
----
2019-04-02 23:33:34 +08:00
$ ../mvnw spring-boot:run
2019-03-20 21:11:46 +08:00
----
Or, better yet, run the `ServiceApplication` main method from your favourite IDE.
== Generating a project
If you go to `localhost:8080` with your browser, you'll get a json document that describes
the capabilities of the service. There are several ways you can generate a project.
If you have `HTTPie` installed, try the following:
[indent=0]
----
$ http :8080
----
If you prefer to use `cURL`, try this instead:
[indent=0]
----
$ curl localhost:8080
----
If you have the `spring` CLI installed, you can also use it as follows:
[indent=0]
----
$ spring init --target http://localhost:8080 --list
----
Finally, you can configure your IDE to point to another service instance.
== Configuration
The configuration in `application.yml` is very simple with a single `web` dependency that
brings `spring-boot-starter-web`. You can experiment by adding more dependencies or other
elements that drive how projects are generated.