/
Guidelines

Guidelines

Convention

REST

Follow the convention from FEDERAL Belgium institutions:

https://www.gcloud.belgium.be/rest/

Java

https://www.oracle.com/technetwork/java/codeconventions-150003.pdf

How to develop

Configuration

Developer is invited to read the property file [application.properties](src/main/resources/application.properties) of Spring boot As you can see context-path and port have been changed Data Source is configured in the class DataSourceConfig because of @Configuration annotation.

Controller

In order to create a new REST service. There are 2 methods (_src/main/java/com/ulegalize/lawfirm/controller/_):

  • Create a new method in the existing controller

  • Create a new Class with @RestController annotation and a new method based on your desired

Logs

This is a Lombok library. Don't forget to install lombok plugin for IntelliJ.
To use it just put @Slf4j in the top of the class and use log.debug , log.info...

Injection/annotation

For each level (controller, service, repo) an annotation is used as followed @RestController, @Service, @Component

To reduce the boilerplate , Service class inject the converter directly into the constructor (If the constructor is too long , the service class has too much responsability) .

Exception

Based on the Error handling convention (RFC 7807 application/problem+json) Two dependencies have been added :

  • zalando problem package

  • Spring security

Enjoy

 

Related content