Connecting Markets East & West
Spring Boot
Bootstrap your application development, batteries included!
STRICTLY PRIVATE AND CONFIDENTIAL
© Nomura
Spring Boot
• Spring Boot is the easiest way to launch a new
application and maintain an existing one.
• “Starter” dependencies include all required
dependencies for standard applications
• Curated compatibility of all dependency versions
• Auto configures deployment environment
• Easily override defaults
• Easily snap in to EOS and/or Propstore
Spring Boot minimum requirements
• Java 8 or greater
• Maven 3 or Gradle 4
• Spring 4 or greater
Spring Boot “Initializr”
•Doesn’t require an IDE:
https://start.spring.io
Initializr – Using IntelliJ
5
Spring Boot Initializr Generated Project
@SpringBootApplication:
• @Configuration – Designates this as a config class
• @EnableAutoConfiguration – Configures using sensible defaults
• @ComponentScan – Scans classpath for Spring classes
7
Starters
• Starter: Curated bills of materials of dependencies and versions, guaranteed to be
compatible.
• All versions are inherited from the parent POM, just specify artifact.
• List of starters https://github.com/spring-projects/spring-boot/tree/master/spring-
boot-project/spring-boot-starters
application.properties/ application.yml
10
Build and run
• Build the project as a jar or war, as with any Maven or Gradle build
mvn install
• Jar contains all dependencies
• To execute:
• java –jar spring-boot-demo-0.0.1-SNAPSHOT.jar
• mvn spring-boot:run
• java –cpxxx
com.nomura.demo.springbootdemo.SpringBootDemoApplication
EOS/LPS Integration
• Requires mvn lps plugin
Specify environment specific details
using LPS env placeholders
Propstore Integration
• Add a maven dependency:
<dependency>
<groupId>com.nomura.fid.core</groupId>
<artifactId>propstore-spring-boot-client</artifactId>
<version>2.0.4</version>
</dependency>
• Add a query property in application.properties:
env property
propstore.property.sources=\
property source
propertySourceName=MyProperties,env=dev || \
Propstore query
system=demo,app=my-app,region=eu
Converting a Web App
• Move the webapp dir into main directory (No longer need WEB-INF)
• Add @Controller annotation to the controller class
• Map a suffix property: spring.mvc.view.suffix=.jsp
• Create your RequestMappings:
IntelliJ Settings for Spring Boot Dev Tools
Registry – Ctrl-Shift-A (then enter “registry”)
logging
CommandLineRunner
Execution:
• java –jar SpringBootDemo.jar
• java SpringBootDemoApplication
Ordering @Order(1)
Profiles
Nested profiles
Testing
Propstore
EOS integration
16