== Spring Boot Example with Camel REST DSL and OpenApi

=== Introduction

This example illustrates how to use https://projects.spring.io/spring-boot/[Spring Boot] with http://camel.apache.org[Camel]. It provides a simple REST service that is created with http://camel.apache.org/rest-dsl.html[Camel REST DSL] and documented with http://swagger.io/[OpenApi]. Additionally, it provides a https://swagger.io/[Swagger] UI, through https://springdoc.org/[Springdoc], to easily interact with your REST API.

The project uses the `camel-spring-boot-starter` dependency, a Spring Boot starter dependency for Camel that simplifies the Maven configuration. 

The project also uses `camel-servlet` component as the HTTP transport component for Camel REST DSL.

=== Build

You can build this example using:

    $ mvn package

=== Run

You can run this example using:

    $ mvn spring-boot:run

After the Spring Boot application is started, you can open the following URL in your web browser to access the REST endpoint and retrieve a list of users: http://localhost:8080/api/users

To use the Swagger UI, open http://localhost:8080/swagger-ui.html

You can also access the REST endpoint from the command line:

[source,text]
----
$ curl http://localhost:8080/api/users
----

The command will produce the following output:

[source,json]
----
[ {
  "id" : 1,
  "name" : "John Coltrane"
}, {
  "id" : 2,
  "name" : "Miles Davis"
}, {
  "id" : 3,
  "name" : "Sonny Rollins"
} ]
----

The OpenApi documentation is located at: `\http://localhost:8080/api/api-doc` and can be retrieved with the following command:

[source,text]
----
$ curl http://localhost:8080/api/api-doc
----

The Spring Boot application can be stopped pressing `[CTRL] + [C]` in the shell.

=== Help and contributions

If you hit any problem using Camel or have some feedback, then please
https://camel.apache.org/support.html[let us know].

We also love contributors, so
https://camel.apache.org/contributing.html[get involved] :-)

The Camel riders!
