Skip navigation
This project is read only now. Read more.

RESTEasy

August 9, 2017 Previous day Next day

Spring Boot

 

Spring Boot is Spring "convention-over-configuration" solution for creating stand-alone, production-grade Spring-based Applications, usually contained in a single and executable jar. It is also an opinionated framework, allowing Spring platform and third-party libraries to be auto-configured, minimizing the need for boilerplate code.

 

One of the most important concepts in Spring Boot is the notion of "starter". According to Spring Boot reference guide, "starters are a set of convenient dependency descriptors that you can include in your application". Another way to see starters is as "the building blocks that leverage auto-configuration when extending your application with Spring or other third-party components".

 

Because of all features Spring Boot offers, it ends up being a very convenient platform to build Java microservices applications, especially considering that Spring Boot has also starters for embedded Servlet containers, such as Tomcat and Jetty.

 

RESTEasy and Spring Boot

 

When it comes to JAX-RS applications, Spring Boot applications can also be RESTEasy applications, and that is possible by using RESTEasy Spring Boot starter, which is an open source project initially developed by PayPal, and endorsed by RESTEasy team.

 

Using RESTEasy in a Spring Boot application

 

Using RESTEasy in a Spring Boot application is very simple, just follow the steps below.

  1. Add dependency com.paypal.springboot:resteasy-spring-boot-starter to your Spring Boot application (it is recommended to use the latest version).
  2. Optionally, register one or more JAX-RS Application classes. To do so, just define it as a Spring bean, and it will be automatically registered.
  3. Finally, to register JAX-RS resources and providers, just define them as Spring beans, and they will be automatically registered.

 

Notice that JAX-RS resources can be singleton or request scoped, while JAX-RS providers must be singletons.

 

See this RESTEasy Spring Boot sample application as an example.

 

References

 

  1. RESTEasy Spring Boot Starter
  2. Spring Boot
  3. Spring Framework - Wikipedia
  4. Spring Boot Reference Guide
  5. Spring Initializr
  6. Microservices in a Nutshell

Filter Blog

By date:
By tag: