tomeksamcik / smava

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

smava

Technologies

  • Java 1.8.0_25
  • Maven 3.3.9
  • Spring Boot 1.3.2.RELEASE
  • Spring MVC
  • Spring Data
  • Spring JMS
  • Active MQ
  • JUnit4
  • AngularJS 1.4.1
  • Bootstrap 3.3.2
  • ngToast 1.5.6
  • Swagger

About

Application consists of six modules, four from which build the web application, one is a standalone jms client and the remaining one is a parent for the web app.

  • smava-data - Data related services
  • smava-jms-consumer - Standalone JMS consumer
  • smava-jms-producer - JMS producer module
  • smava-parent - Parent module
  • smava-rest - RESTful API exposing CRUD operations
  • smava-web - Executable Spring Boot web application bundling data, jms-producer and rest modules

Building application

This will run the build, test and install all the smava-parent submodules in local Maven repository:

cd smava-parent
mvn clean install

This will build, test and install standalone JMS consumer module (note that test requires a running instance of ActiveMQ broker on port 61616, you can ignore that requirement by skipping tests with -DskipTests flag)

cd smava-jms-consumer
mvn clean install

Running application

This launches the application in an embedded Tomcat instance running on port 8080 (running application also requires a running ActiveMQ broker)

cd smava-web
mvn spring-boot:run

This runs the standalone jms consumer module connecting to the local jms broker instance.

cd smava-jms-consumer
mvn spring-boot:run

This builds a war file that is deployable in a servlet container (I only tested with Tomcat 7)

cd smava-web
mvn clean package

Configuration

The only configuration needed is selecting data storage, it can either be a h2 in-memory persisted storage or http session storage.

Confugiration has to be made in de.smava.Application class in smava-web module.

Persistent storage:
@Bean
  public AccountService accountService() {
  return new AccountPersistentService();
}
Session-based storage:
@Bean
  public AccountService accountService() {
  return new AccountSessionService();
}

Notes

  • RESTful endpoint is based on Spring MVC rather then JAX-RS, because Jetty conflicted with the Spring Boot embedded web container. Spring Boot simplifies bootstrapping applications, but makes it more troublesome to customize things.
  • Endpoint descriptor is done with Swagger rather then WADL, because there is no out-of-the-box support for WADL in Spring MVC. There are some custom solutions, but hard to implement
  • I haven't found a tool for client code generation based on Swagger descriptors
  • Swagger UI is available after runnig the application at http://localhost:8080/swagger-ui.html
  • Swagger API descriptor is available at http://localhost:8080/v2/api-docs?group=account
  • Account API is available at http://localhost:8080/account
  • Web front end at http://localhost:8080
  • The whole code is not java documented, only meaningful parts of API
  • Message broker connection is auto-configured, Spring Boot attempts to connect to local instance

About


Languages

Language:Java 81.0%Language:JavaScript 13.7%Language:CSS 5.3%