Used Technology

Most of professional Java projects over the past decade have been based on Spring or JEE. Both platforms are mature but suffer from different problems. JEE has changed quite dramatically over the years, but is still judged on issues deprecated since EJB 2.x.

The Spring Framework is an open source application framework that aims to make JEE development easier. Unlike single-tier frameworks, Spring aims to help structure whole application in a consistent, productive manner, puling together best-of-breed single tier frameworks to create a coherent architecture.

The Spring Framework is an incredibly powerful tool - once we get it setup. For example, Spring Data JPA gives us easy relational database management without writing DAO classes - once we get it setup. There is config-driven access to AMQP message queues, enterprise integration and robust batch processing with little or no code - once we get it setup.

Bootstrapping a Spring application can be painful. Part of this is due to the sheer size and growth rate of the portfolio. Also, Spring seldom deprecates anything, and offers little opinion or guidance. This is a large part of why XML-based config is still common, even though annotation-based config is easier to maintain.

In this tutorial, we will use Spring Boot to setup our Spring-powered application. Spring Boot is attempt to easy Spring setup.Spring Boot aims to make it easy to create Spring-powered, production-grade applications and services with minimum fuss. It takes an opinionated view of the Spring platform so that new and existing users can quickly get to the bits they need. We can use it to create stand-alone Java applications that can be started using java -jar or more traditional WAR deployments.

The primary goals of Spring Boot are:

  • To provide a radically faster and widely accessible "getting started" experience for all Spring development.
  • To be opiniated out of the box, but get out of the way quickly as requirements start to diverge from the defaults.
  • To provide a range of non-functional features that are common to large classes of projects (e.g. embeded servers, security, metrics, health check, externalized configuration).

One of the biggest benefits is configuring resources based on what it finds in our classpath. If our Maven POM includes JPA dependencies and MySQL driver, then Spring Boot will setup a persistence unit based on MySQL. If we add a web dependency, then we will get Spring MVC configured with sensible defaults.

In the following chapters, we will see how to use it for developing RESTful web services.

One of the requirements that our application should met is the possibility to export reports about project in various formats (pdf, xls,...). For reporting we will use Java reporting library called DynamicReports.

DynamicReports is based on JasperReports and it allows to create dynamic report designs. It doesn't need a visual report designer - design is created by pure simple Java code. It is generated at runtime and allow us to implement any logic in our code which decide how the report will look like unlike the static reports (jrxml JasperReports template) where the defined design cannot be changed at runtime. Also it allow us to inherit design for report from another design.