Ready! Steady!
Spring Boot!
Maksym Fastovets
Senior Software Engineer, Consultant
Agenda
1. What is Spring Boot;
2. Project domain;
3. Spring Boot application modules structure;
4. Flyway and Spring Data;
5. Spring MVC, Swagger and RESTful API.
2
What is
Spring
Boot?
3
Features
- Create stand-alone Spring apps
- Embed Tomcat, Jetty or Undertow directly
- Provide opinionated 'starter' POMs to simplify your Maven config
- Automatically configure Spring whenever possible
- Provide metrics, health checks features and externalized configuration
- Absolutely no code generation and no requirement for XML configuration
4
Project domain
Simple web application for tracking users activities in
scope of some projects.
No UI, only RESTful API exposed
5
Project structure
Root project is named timetracker which includes
two gradle modules:
- timetracker.db
- timetracker.main
6
Application.properties
As project is rather simple, application.properties
contain only datasource and JPA settings.
7
Database
In-memory H2 database is used for simplicity as it doesn’t
require any installations, dependency in gradle build file is just
enough.
H2 also provides web console (its default URL is /h2-console)
which allows to manipulate data (query, update, insert, delete,
etc.)
8
Database version control with Flyway
I used pure sql flyway migration files.
They by default should be placed in
the /resources/db/migration folder of
the timetracker.db module.
9
Database structure
10
Spring Data and JPA entities
- Spring Data abstracts the way data is accessed in the code
from external data sources and allows to concentrate on
manipulating the POJOs (entities) rather then working with
low level classes such as Session, EntityManager, etc.
- CrudRepository<T, ID> and its magic syntax.
- JPA Entities.
11
DbModuleConfig
12
timetracker.main module structure
Сonfigurations
StaticResourceConfiguration;
SwaggerConfiguration;
TimeTrackerApplication.
Controllers
UserController;
ProjectController;
WorkController.
Services
UserService;
WorkService.
13
Project’s RESTful API
14
Example
15
Questions
16
Thank you!
maksym.fastovets@globallogic.com

Ready! Steady! SpringBoot!