- Initial project structure should be corresponded with Maven standard directory layout
- Project components should be divided by feature. For example:
com.demo.project
└───user
│ │
│ └───component
│ │ │ UserComponent.java
│ │ │ UserMetaDataComponent.java
│ │ │ ...
│ │
│ └───service
│ │ │UserService.java
│ │ │UserPaymentService.java
│ │ │ ...
│ │
│ └───model
│ │User.java
│ ...
- Interface definitions shouldn't be prefixed with
I
. - All public methods should be written at the top of the class, all private method at the bottom
- All ORM Entities should have a postfix entity in the definition. It helps divide dto classes and entities
- Use DTO classes without postfix DTO
- If that possible - use Lombok library for Java boilerplate code generation
- important Don't use Lombok
@EqualsAndHashCode
method for ORM entities.
- important Don't use Lombok
- Use db migration tools when you have to change the db structure. (e.g. flyway or liquibase)
- Use checkstyle plugin with predefined rules.