No Magic: Out-of-the-box RESTful Services with Rebel and Spring

By constantly challenging the possibility to automate software development, we have introduced auto-generation of Spring components: MVC Controllers, along with Repositories and Services. Since version 2.1, Rebel will automatically create these classes for your domain model.

Basic RESTful service with CRUD functionality is available to you with no coding at all.

How to use this feature?

First, you need to mark some packages from your UML model using stereotypes: repository, service, and controller, as shown on a picture below.

Annotating Spring Packages
Project packages to be used by the Spring Generator

The UML model package marked as repository informs Rebel that you need Spring Data Repositories for each one of persistent classes from your domain model. You can configure a base class for all your repositories using Rebel project preferences.

Going further, if you aim for creating a RESTful service, there are chances that you would need to create Spring MVC Controllers for your domain classes. You don't have to do it yourself. Instead, you can use Rebel automation by marking two model packages using service and controller stereotypes. Rebel will then create both Spring Service and Controller for each one of your persistent classes.

Picture below shows Controller class auto-generated by the Rebel for the domain class Account.

Rebel auto-generated Spring MVC Controller
Rebel auto-generated Spring MVC Controller

Finally, you can control Rebel behavior on a class level, by switching on/off code generation for these different components. For more information, please see the description of the Spring Profile.

Unlike the rest of the generated Java sources, auto-generated Spring components do not use preserved sections. Their purpose is to provide you with a good starting point for your further development and you can modify them in any way you want - your changes will be preserved in the subsequent code generations.

To use auto-generation of Spring components, upgrade to Rebel Plus.

Great work provides a great integrity.