Skip to main content

Progressively building a modular Spring Web applications

This is going to be a series of posts in which I will try to demonstrate how to build a complex modular Spring web application. We will use progressive enhancement to slowly improve and build this application. So what are we going to build? OK here is a small set of requirement we will try to cater :

Requirements

  1. Sign in user
  2. Sign out user
  3. Create a lead
  4. Edit lead
  5. List lead
  6. Copy lead
  7. View History of lead changes
  8. Send mails to these leads as part of some camapign
  9. Delete lead

Some non functional requirements I will look into are:

  1. Modular application module - so that it should seamlessly include a new module. Lets say tomorrow we want to include an opportunity module it should work by dropping in a jar with views, navigation, menu items, context menu etc - just with server restart.
  2. Must be able to support NoSQL stores with minimal changes.

I have generally selected the following as my tool and technologies:

  1. Spring Framework 3.1.2 - core framework
  2. Spring DATA - For data access
  3. Thymeleaf for templates - sorry I will not use JSF 2 and rich UI frameworks like Primefaces, Richfaces etc. They are awesome, but I would love to have more control and flexibility with my UI. Also JSF 2 even with nicities and improvements has lot to learn.
  4. Spring Web flow 2.3.x ---- will try to implement if does not hamper my modular requirements
  5. Spring Security
  6. Spring Integration
  7. Spring Social
  8. Tomcat 7 - Server
  9. Spring Source Toolsuite --- IDE
  10. Maven - Build tool

So far so good, we will add or update things as per feedback and if required.

The project will be available on some Google code repository soon. I will tag it as I go along.

 

Comments

Popular posts from this blog

Why do you need Spring Cloud Config server?

Last month I wrote a primer on concepts around 12 factor app. Before getting into the details of the Spring Cloud Config Server, I must refresh on the principle #3 from the list presented in that post.

3 – ConfigurationStore config in the environments
Configuration information must be separate from the source code. This may seem so obvious, but often we are guilty of leaving critical configuration parameters in the scattered in the code. Instead, applications should have environment specific configuration files. The sensitive information like database password or API key should be stored in these environment configuration files in encrypted format.
 The key takeaways from this postulate for a cloud-native microservices application are:
Do not store configuration as part of the deployable unit (in the case of lead microservice - inside the jar or war if you are still deploying war like the good old days). Instead, store it in an external location and make it easily accessible during run-…

Upgrading Lead Microservice - Use MariaDB and Flyway with Spring Boot

So far I have been using an in-memory H2 database or Mockito for testing the lead microservice. To make the transition towards using the Spring Cloud Config server, I need to upgrade the micro-application to use MariaDB. I will be adding the configuration in the application.yml  the file which in the subsequent post will move over to the config server store. I will also be using Flyway to make it easy to maintain the database schema changes in future. I will use this post to introduce Flyway in the mix. Spring Boot also provides first class integration with Flyway. I am using Flyway as its really quick and easy to get started, minimal learning curve (no DSL) and I am comfortable with it having used it in the past.

Assumptions

MariaDB 10 is installedBasic familiarity with FlywayHeidi SQL client is installed.
Step 1 - Update build.gradle to include the MariaDB JDBC and Flyway dependencies.
Do not forget to do a Gradle refresh on your IDE (I am using STS 3.8.4 on Java 8)

Step 2 - Rename the…

Part 3 - Integrating Tiles, Thymeleaf and Spring MVC 3

In this post I will demonstrate how to integrate Apache Tiles with Thymeleaf. This is very simple. The first step is to include the tiles and thymeleaf-tiles extension dependencies. I will include them in the pom.xml. Note we wil lbe using Tiles 2.2.2Listing 1 - parent/pom.xml --- thymeleaf-tiles and tiles dependencies <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<!-- Tiles -->
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->

<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-core</artifactId>
<version>${tiles.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-template</artifactId>
<version>${tiles.version}</version>
<scope>compile</scope>