Java spring-boot application, written to level up knowledge of maven build tool, spring boot, and some libraries. It is a back-end part of the abstract Museum Website and provides REST endpoints with basic CRUD functionality.
The project has basic 'onion' or three-layer architecture.
on 2023-08-18
.
├── docker-compose.yml
├── Dockerfile
├── domain
│ ├── domain.iml
│ └── target
│ ├── classes
│ ├── generated-sources
│ │ └── annotations
│ ├── generated-test-sources
│ │ └── test-annotations
│ └── test-classes
├── mvnw
├── mvnw.cmd
├── pom.xml
├── Project-simple-diagram.png
├── README.md
└── src
├── main
│ ├── java
│ │ └── com
│ │ └── example
│ │ ├── Application.java
│ │ ├── constants
│ │ │ └── TestConstants.java
│ │ ├── constraints
│ │ │ ├── museum
│ │ │ │ ├── ArticleConstraints.java
│ │ │ │ ├── AuthorConstraints.java
│ │ │ │ └── EventConstraints.java
│ │ │ ├── SharedConstraints.java
│ │ │ └── users
│ │ │ └── UserConstraints.java
│ │ ├── domain
│ │ │ ├── museum
│ │ │ │ ├── Article.java
│ │ │ │ ├── Author.java
│ │ │ │ └── Event.java
│ │ │ └── users
│ │ │ └── User.java
│ │ ├── dto
│ │ │ ├── museum
│ │ │ │ ├── article
│ │ │ │ │ ├── ArticlePublishingForm.java
│ │ │ │ │ ├── ArticleWithContent.java
│ │ │ │ │ └── ArticleWithoutContent.java
│ │ │ │ ├── author
│ │ │ │ │ ├── AuthorRegistrationForm.java
│ │ │ │ │ └── AuthorShortResponse.java
│ │ │ │ └── event
│ │ │ │ ├── EventPublishingForm.java
│ │ │ │ ├── EventWithContent.java
│ │ │ │ └── EventWithoutContent.java
│ │ │ └── users
│ │ │ ├── UserRegistrationForm.java
│ │ │ └── UserResponse.java
│ │ ├── repositories
│ │ │ ├── museum
│ │ │ │ ├── ArticleRepository.java
│ │ │ │ ├── AuthorRepository.java
│ │ │ │ └── EventRepository.java
│ │ │ └── users
│ │ │ └── UserRepository.java
│ │ ├── services
│ │ │ ├── museum
│ │ │ │ ├── ArticleService.java
│ │ │ │ ├── AuthorService.java
│ │ │ │ ├── EventService.java
│ │ │ │ ├── exceptions
│ │ │ │ │ ├── ArticleNotFoundException.java
│ │ │ │ │ ├── AuthorAlreadyExistException.java
│ │ │ │ │ ├── AuthorNotFoundException.java
│ │ │ │ │ └── EventNotFoundException.java
│ │ │ │ └── impl
│ │ │ │ ├── ArticleServiceImpl.java
│ │ │ │ ├── AuthorServiceImpl.java
│ │ │ │ └── EventServiceImpl.java
│ │ │ └── users
│ │ │ ├── exceptions
│ │ │ │ ├── UserAlreadyExistsException.java
│ │ │ │ └── UserNotFoundException.java
│ │ │ ├── impl
│ │ │ │ └── UserServiceImpl.java
│ │ │ └── UserService.java
│ │ └── web
│ │ ├── exceptionhandler
│ │ │ └── RestExceptionHandler.java
│ │ ├── museum
│ │ │ └── controllers
│ │ │ ├── ArticleController.java
│ │ │ ├── AuthorController.java
│ │ │ └── EventController.java
│ │ └── users
│ │ └── UserController.java
│ └── resources
│ ├── application.yml
│ └── db
│ └── migration
│ ├── V1__initial_schema.sql
│ └── V2__fake_data.sql
└── test
├── java
│ └── com
│ └── example
│ ├── config
│ │ ├── AbstractInstancioDomainTest.java
│ │ ├── AbstractInstancioTest.java
│ │ ├── AbstractRepositoryIntegrationTest.java
│ │ └── AbstractServiceIntegrationTest.java
│ ├── domain
│ │ ├── museum
│ │ │ ├── ArticleTest.java
│ │ │ ├── AuthorTest.java
│ │ │ └── EventTest.java
│ │ └── users
│ │ └── UserTest.java
│ ├── dto
│ │ ├── museum
│ │ │ ├── article
│ │ │ │ ├── ArticlePublishingFormTest.java
│ │ │ │ ├── ArticleWithContentTest.java
│ │ │ │ └── ArticleWithoutContentTest.java
│ │ │ ├── author
│ │ │ │ ├── AuthorRegistrationFormInstancioTest.java
│ │ │ │ └── AuthorShortResponseInstancioTest.java
│ │ │ └── event
│ │ │ └── EventPublishingFormTest.java
│ │ └── users
│ │ ├── UserRegistrationFormInstancioTest.java
│ │ └── UserResponseInstancioTest.java
│ ├── repositories
│ │ ├── museum
│ │ │ ├── ArticleRepositoryIntegrationTest.java
│ │ │ ├── AuthorRepositoryIntegrationTest.java
│ │ │ └── EventRepositoryIntegrationTest.java
│ │ └── users
│ │ └── UserRepositoryIntegrationTest.java
│ ├── services
│ │ ├── museum
│ │ │ └── impl
│ │ │ ├── ArticleServiceImplIntegrationTest.java
│ │ │ ├── AuthorServiceIntegrationTest.java
│ │ │ └── EventServiceImplIntegrationTest.java
│ │ └── users
│ │ └── impl
│ │ └── UserServiceIntegrationTest.java
│ └── web
│ ├── museum
│ │ └── controllers
│ │ ├── ArticleControllerTest.java
│ │ └── EventControllerTest.java
│ └── users
│ └── UserControllerTest.java
└── resources
- Language: Java-17
- Build tool: Apache Maven
- Main framework: Spring Boot 3.1.2
- CI: GitHub Actions
- Deployment: Docker with Docker Compose plugin
- Spring Web.
- REST Controllers for endpoints
- RestControllerAdvice for exception handling
- Swagger (Springdoc OpenAPI)
- Generating openAPI documentation
- Swagger Web UI by link: swagger-ui
- Jackson databind
- Spring Data JPA
- Hibernate as default ORM framework
- Records DTO projections for retrieving data
- Transaction management by spring @Transactional
- Flyway SQL migration, for managing schemes versions
- PostgreSQL as RDBMS
- JUnit 5
- Mockito
- Spring Boot Test
- MockMVC for testing API cals
- SpringBootTest for integration testing
- Testcontainers for integration testing
- Instancio for generating fake test data
- Lombok
- Java Bean Validation (Hibernate Validation)
Now the project is in development, and not everything should work perfectly fine 😊.
But I fix all issues as soon as possible 😅.
What do you need:
- You should have Docker with Docker compose plugin (or Docker desktop) installed on your machine. Link with instructions: Get Docker
- Java 17 installed. I recommend using SDK-man for this. It is not so easy on Windows, but it is worth it. (Link on GitHub post: Using SDKMAN! with git for Windows shell (git bash)).
- And that`s it 😎.
Installation steps:
- Clone this repository.
- Run another command:
./mvnw clean install
- Run this command in your terminal (on Linux and Mac), Power-Shell or Git-bash (on Windows), but first of all move to the root of the project:
docker compose up -d
- Open link in your browser: swagger-ui
- Test endpoints with the Swagger UI 😀