Commons is a package that contains shared constants, objects and classes among the microservices. The reason of the usage of this dependency package is to avaoid code duplication and improve code reusabilty.
@NotNull
is used to mark a field as mandatory.- This annotation is used in MandatoryFieldValidator.java
- This package contains shared constant variables by microservices. For instance, service and header names.
- This package contains two different entity class. The reason of this package is to provide a common entity structure in the project. For instance, mete data usage.
- AbstractEntity.java: Abstraction of an entity class. Contains meta informations. (createdAt, createdBy, uodatedAt, updatedBy)
- ResourceEntity.java: Extends
AbstractEntity.java
and inherits resourceId field to the classes who extends this class.
- This package contains a customized RunTimeException. Multiple ErrorMessages can be added to throw multiple errors at the same time.
- In the constants package, an enumurated needs to be defined that contains title and error code. So that error body can be initialized easily.
- TokenHelper.java
- Generated JWT Tokens and checks whether a token is expired or not.
- Abstraction of mappers. This class needs to be extended by all of the mappers so that, thanks to Mapstruct, creating a java class will be enought to generate mapper implementations.
- Model - Request models that are consumed by controllers. - Rest - This package contains a http request client to be able to send rest request easily. It is used to send a REST request from a microservice to the another microservice.
-
- This is a common return type of all methods in the constructors. Thanks to Builder Pattern an instance of this object can be generated.
-
- This response object is for the responses that are parsed by HttpRestClient. On the other word, this response object uses for the internal request results.
- Contains utility classes for complex type Java objects.
- This package contains abstraction of a validator and the validation facade.
Facade Pattern
is being used for validations. - MandatoryCheckValidator is a common validation class. This is a singleton classs. Instead of most of the validators in Scrumier, it is not a spring bean.
-
- In order to be able to contribute this package, you need to fork this repository and clone it into your local.
- Create a feature branch from master.
- Push your changes to your feature branch on your fork.
- Create a pull request from the feature branch on your fork to the master branch on this repository
-
- Add your authentication information to ~/.m2/settings.xml so that the github site-maven-plugin can push to GitHub
<settings> <servers> <server> <id>github</id> <username>YOUR-USERNAME</username> <password>YOUR-PASSWORD</password> </server> </servers> </settings>
- Run the following command and then you suppose to be able to see the new artifact in https://github.com/orkungdk/commons/tree/maven-repo
mvn clean deploy