SlideShare a Scribd company logo
1 of 26
SpringBoot
+ Groovy, Gorm, Gradle
Presented by: Vasu Srinivasan, Texas NIC Usa
For: Austin Groovy-Grails User Group (AGGUG), 2014-06-12
about:me
 Vasu Srinivasan
 Sr Tech Consultant at Texas NIC, USA
 Twitter: @vasya10
 Blog: http://vasya10.wordpress.com
 Slides: http://www.slideshare.net/vasya10/
 Videos:
 Battle of Programming Languages -https://www.youtube.com/watch?v=dKftGfU0giA
 Along with Eric Kelm (@asoftwareguy, asoftwareguy.com)
 Current interests
 Grails/Groovy, AngularJS, SharePoint, Java, MongoDB, NodeJs
about:Texas NIC, USA
 NIC is in 29 states, specializing in e-government
 scrum teams
 Grails, SpringBoot, Spring, Oracle SOA, SharePoint, .Net stack
 major applications
 www.texas.gov
 licensing applications
 driver license renewals and reinstatements
 concealed handgun
 occupational and renewal licenses
 birth and death certificates
 vehicle inspections
 texas department of criminal justice - Inmates App
 and many many more!
 our work benefits and impacts Texans directly
why-not:spring
 scalability has become a key issue for enterprise applications
 stateless services provide better scalability
 stand-alone monolithic servlet container and cluster management has in
some cases become a specialized job (WebSphere anyone?)
 a simple http server is sufficient for many small-to-medium applications
 how application is deployed, forces how to write code
 conceptually this will not change, but a certain level of freedom goes a long way
in maintenance and extensibility
 ramp up time to create a simple starter app is pretty high
 many modern web frameworks have < 5 minutes to download the libraries and
create a simple application
why:spring-boot
 xml as a configuration – an idea’s time has passed (long ago)
 obviously verbose, bloated and error-prone
 many post-Spring web frameworks use zero xml for configuration
 Rails, Grails, Play, Wicket, etc.
 ramp up time is a very important criteria
 Play? play install run !
 Or Grails? grails create-app !
 opinionated frameworks are becoming fashionable, again?
 Spring had to do something to compete with fast evolving frameworks such
as DropWizard, Ratpack, Sinatra, Scalatra with the concept of “micro-
services architecture” (MSA)
 With its vast supporting frameworks/libraries including a solid DI
mechanism, it needed a simple way to tie them all
opinionated frameworks
 frameworks that have
strong opinions about
themselves
 framework by developers
who have strong opinions
about what goes in
why:boot
 spring booted xml out:
so “SpringBoot”
 of course, that’s the unofficial version of the story
about:spring-boot
 container project for creating new Spring based applications
 embedded servlet container: Tomcat or Jetty
 starter POMs for many libraries (web, jdbc, log, data etc)
 auto configurations
 actuators (health, metrics, beans, shutdown, ssh, etc.)
 xml, java annotated, groovy bean configurations
 xml configuration not mandatory anymore
 supports many dbs via spring-data
 helps blend web and non-web (eg. batch) functionality
 supports many views
 jsp (limited), thymeleaf, and groovy template engine too! (1.1.0)
using:groovy
 traditional Spring apps are mostly in Java, but Groovy is a
smoother, richer language
 Groovy enriches Spring Boot in many ways
using:boot-with-groovy
Groovy in Boot How?
Using spring-cli, run Groovy
scripts
spring run app.groovy
but would anyone do this in prod? not sure.
Use groovy as the
language, instead of Java,
the language
apply plugin: ‘groovy’
compile (“org.codehaus.groovy:groovy:$groovyVersion)
Use Groovy Bean
configuration instead of xml
Boot’s GroovyBeanDefinitionReader wires the
beans
Just like Grails resources.groovy
Use Groovy Template
Engine
since Boot 1.1.0 and
Groovy 2.3.2
easy to create html via markup template.
templates in src/main/resources/templates/*.tpl
practical in cases where html is an overkill (email
templates, display history data etc.)
compile "org.codehaus.groovy:groovy-
templates:${groovyVersion}"
Using Gorm Spin-off from Grails
compile("org.grails:gorm-hibernate4-spring-
boot:1.0.0.GA")
using:boot-with-groovy highlights
 Some immediate advantages using Groovy
 Practical and time-saving annotations
 @ToString, @Log, @EqualsAndHashCode
 Faster Json conversions (with Groovy 2.3)
 Null-safe operations
 Groovy Strings
 Test using Spock
 Many classes can apply @CompileStatic and be as fast as
Java
spring-boot:demo1
 Starter Project – Spring Initializer
 start.spring.io
 add required poms, select “Gradle Project”
 unzip the downloaded file
 Add default gradle wrapper artifacts
 Fix Application.groovy
 Add logback.groovy
 gradlew clean bootRun
 In Mac/Linux use gvm, lazybones
 http://www.nautsch.net/2014/04/15/spring-boot-running-in-2-min/
spring-boot:demo1
 Actuators
 /beans
 /metrics
 /health
 /shutdown
 /trace
 /dump
 Auto-configures database for HSQL DB
 Auto-configures a bunch of other beans
 Adds a default Tomcat servlet container to run on port
8080
spring-boot:demo2
 Star Catalog
 Simple Rest Service (Get and Post)
 AngularJS as client
 Batch Processing
 Groovy Bean Configuration
 Groovy Template Engine as View layer
spring-boot:good-bad-and-ugly
Good, Baffling and the Unexpected
spring-boot:good
 traditional Spring MVC (xml) developers will
surely see advantages in reduced / manual
configurations
 rest made easy
 deployment made easy
 auto-configurations largely reduce initial
dependency management
 java annotated configurations provide type-
safety check
 well modularized, instead of a “kitchen-sink”
approach
 gradle support is awesome
spring-boot:baffling
 Multiple ways to setup properties
 application.properties, application.yml
 Decide on early. Go YAML.
 Too many logging frameworks are
included in classpath
 Strongly recommend to use logback as
standard, logback.groovy works fine
 No out of the box support for profiles
 Grails by default provides environment blocks in the configurations, making it
super easy to configure for different environments
 In SpringBoot, some handcraft is required to create profiles (development
section in yml or application-development.properties)
 Power of grailsApplication.config will be missed
spring-boot:baffling
 Too many @configuration related annotations
 @AutoConfigure, @Configuration, @EnableConfiguration,
@EnableConfigurationProperties, @ConfigurationProperties, @PropertySource,
@Value
 Annotations cannot be intuitively applied, reference documentation is the main
guide
 Too many annotations in general – sometimes I wonder what is my business
logic (@Bean, @PostConstruct, @ComponentScan)
 once you get past the auto-configuration magic, overriding the
configurations takes a bit of discovery time
 what to wire?
 what properties are required?
spring-boot:baffling
 what are my views?
 jsp (anyone still using this???!)
 thymeleaf (good and clean library)
 groovy template engine
 gsp (stand-alone spin-off from grails)
 where are my views?
 recommended path is src/main/resources/static
 too deep in the IDE view
 IDE settings can mistake static to be a java package, resulting in undesirable refactors
(rename for eg)
 or use webjars for javascript jars
 UI Team may like to use bower like js dependency package tools
 are webjars always current?
 need build customizations if using bower, sass
 no out of box support (yet) or grails plugin like asset-pipeline (opportunity to develop!)
spring-boot:unexpected
 Grails Domain objects cannot be converted to
Json directly
 needs a custom mapper in between
 Not all xml configuration enhancements
translate to Groovy Bean DSL
 eg. <ctx:annotation-config/> works
 but not <batch:/>
 Broke in Spring Boot 1.1.x
 Gorm @Transactional is broke – throws Proxy error
 Gorm methods are not available at startup time (Bootstrap/InitializingBean)
 substitute with a manual restful controller initiated call to initialize records
spring-boot:ide tricks (IntelliJ)
 run the main application directly, not via gradle bootRun
 For debugging add VM option
 -javaagent:/path/springloaded-1.2.0.RELEASE.jar -noverify
 then, debug the main application
 sometimes port is not released (Windows)
 netstat –o –a –n | findstr “8080”
 stop-process $id
 Associate groovy template .tpl files with “Groovy” for
auto-formatting
spring-boot:nice-to-have
 faster creation of project templates, instead of browser
 groovy configuration support (like .properties, .yaml)
 richer runtime evaluations, environment block support
 out of the box support for common active profiles
 expose entities as Rest Entities for prototypes (like Grails
@Resource)
 tooling support for Groovy Bean DSL and GTE
 Well, perhaps they are already in the making … ?
 grails-boot?
spring-boot:should we?
 already a heavily invested traditional Spring shop?
 desperately want to scale your apps now?
 xml configurations giving you nightmares or headaches?
 want a better deployment strategy?
 want to hop on the micro-services wagon?
 can’t wait for grails-boot?
 all of the above?
 any one of the above?
Links, References, Acknowledgements
 Spring Initializr - http://start.spring.io
 http://www.infoq.com/articles/microservices-intro
 http://docs.spring.io/spring-boot/docs/current-
SNAPSHOT/reference/htmlsingle/
 Demo Application (StarCatalog) - https://github.com/vasya10/spring-boot-
batch-sample
 Testing SpringBoot with Spock -
http://fbflex.wordpress.com/2013/09/18/testing-spring-boot-applications-
with-spock/
 Google Image search for cute Puss in Boots images
 Disney / Dreamworks for Puss in Boots images
 Images are used in good intention only to illustrate context of topic
Thank you!
Austin Groovy/Grails User Group
ReachForce, Austin
Texas NIC, Austin (Sponsor)
SpringBoot, Groovy, Grails, Gradle team!

More Related Content

What's hot

Springboot and camel
Springboot and camelSpringboot and camel
Springboot and camelDeepak Kumar
 
Spring boot introduction
Spring boot introductionSpring boot introduction
Spring boot introductionRasheed Waraich
 
Spring boot - an introduction
Spring boot - an introductionSpring boot - an introduction
Spring boot - an introductionJonathan Holloway
 
Getting Reactive with Spring Framework 5.0’s GA release
Getting Reactive with Spring Framework 5.0’s GA releaseGetting Reactive with Spring Framework 5.0’s GA release
Getting Reactive with Spring Framework 5.0’s GA releaseVMware Tanzu
 
Spring Boot and Microservices
Spring Boot and MicroservicesSpring Boot and Microservices
Spring Boot and Microservicesseges
 
Spring Boot & Actuators
Spring Boot & ActuatorsSpring Boot & Actuators
Spring Boot & ActuatorsVMware Tanzu
 
Introduction to Spring Boot!
Introduction to Spring Boot!Introduction to Spring Boot!
Introduction to Spring Boot!Jakub Kubrynski
 
Building a Spring Boot Application - Ask the Audience!
Building a Spring Boot Application - Ask the Audience!Building a Spring Boot Application - Ask the Audience!
Building a Spring Boot Application - Ask the Audience!🎤 Hanno Embregts 🎸
 
Introduction to Spring Boot
Introduction to Spring BootIntroduction to Spring Boot
Introduction to Spring BootTrey Howard
 
Migrating 25K lines of Ant scripting to Gradle
Migrating 25K lines of Ant scripting to GradleMigrating 25K lines of Ant scripting to Gradle
Migrating 25K lines of Ant scripting to Gradle🎤 Hanno Embregts 🎸
 
How to customize Spring Boot?
How to customize Spring Boot?How to customize Spring Boot?
How to customize Spring Boot?GilWon Oh
 
Springboot introduction
Springboot introductionSpringboot introduction
Springboot introductionSagar Verma
 

What's hot (20)

Springboot and camel
Springboot and camelSpringboot and camel
Springboot and camel
 
Spring boot introduction
Spring boot introductionSpring boot introduction
Spring boot introduction
 
Spring boot - an introduction
Spring boot - an introductionSpring boot - an introduction
Spring boot - an introduction
 
Getting Reactive with Spring Framework 5.0’s GA release
Getting Reactive with Spring Framework 5.0’s GA releaseGetting Reactive with Spring Framework 5.0’s GA release
Getting Reactive with Spring Framework 5.0’s GA release
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Spring Boot and Microservices
Spring Boot and MicroservicesSpring Boot and Microservices
Spring Boot and Microservices
 
Spring boot
Spring bootSpring boot
Spring boot
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
SpringBoot
SpringBootSpringBoot
SpringBoot
 
Introduction to spring boot
Introduction to spring bootIntroduction to spring boot
Introduction to spring boot
 
Spring Boot & Actuators
Spring Boot & ActuatorsSpring Boot & Actuators
Spring Boot & Actuators
 
Introduction to Spring Boot!
Introduction to Spring Boot!Introduction to Spring Boot!
Introduction to Spring Boot!
 
Spring Boot Tutorial
Spring Boot TutorialSpring Boot Tutorial
Spring Boot Tutorial
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Building a Spring Boot Application - Ask the Audience!
Building a Spring Boot Application - Ask the Audience!Building a Spring Boot Application - Ask the Audience!
Building a Spring Boot Application - Ask the Audience!
 
Xke spring boot
Xke spring bootXke spring boot
Xke spring boot
 
Introduction to Spring Boot
Introduction to Spring BootIntroduction to Spring Boot
Introduction to Spring Boot
 
Migrating 25K lines of Ant scripting to Gradle
Migrating 25K lines of Ant scripting to GradleMigrating 25K lines of Ant scripting to Gradle
Migrating 25K lines of Ant scripting to Gradle
 
How to customize Spring Boot?
How to customize Spring Boot?How to customize Spring Boot?
How to customize Spring Boot?
 
Springboot introduction
Springboot introductionSpringboot introduction
Springboot introduction
 

Similar to Spring boot 3g

JVM Web Frameworks Exploration
JVM Web Frameworks ExplorationJVM Web Frameworks Exploration
JVM Web Frameworks ExplorationKevin H.A. Tan
 
Workflow automation for Front-end web applications
Workflow automation for Front-end web applicationsWorkflow automation for Front-end web applications
Workflow automation for Front-end web applicationsMayank Patel
 
Magic with groovy & grails
Magic with groovy & grailsMagic with groovy & grails
Magic with groovy & grailsGeorge Platon
 
Lean microservices through ahead of time compilation (Tobias Piper, Loveholid...
Lean microservices through ahead of time compilation (Tobias Piper, Loveholid...Lean microservices through ahead of time compilation (Tobias Piper, Loveholid...
Lean microservices through ahead of time compilation (Tobias Piper, Loveholid...London Microservices
 
Google App Engine for Java
Google App Engine for JavaGoogle App Engine for Java
Google App Engine for JavaLars Vogel
 
Java to Golang: An intro by Ryan Dawson Seldon.io
Java to Golang: An intro by Ryan Dawson Seldon.ioJava to Golang: An intro by Ryan Dawson Seldon.io
Java to Golang: An intro by Ryan Dawson Seldon.ioMauricio (Salaboy) Salatino
 
Airflow - a data flow engine
Airflow - a data flow engineAirflow - a data flow engine
Airflow - a data flow engineWalter Liu
 
Ratpack - Classy and Compact Groovy Web Apps
Ratpack - Classy and Compact Groovy Web AppsRatpack - Classy and Compact Groovy Web Apps
Ratpack - Classy and Compact Groovy Web AppsJames Williams
 
Google App Engine for Java
Google App Engine for JavaGoogle App Engine for Java
Google App Engine for JavaLars Vogel
 
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13Fred Sauer
 
CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...
CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...
CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...Jesse Gallagher
 
The 90-Day Startup with Google AppEngine for Java
The 90-Day Startup with Google AppEngine for JavaThe 90-Day Startup with Google AppEngine for Java
The 90-Day Startup with Google AppEngine for JavaDavid Chandler
 
GWT is Smarter Than You
GWT is Smarter Than YouGWT is Smarter Than You
GWT is Smarter Than YouRobert Cooper
 
node.js 실무 - node js in practice by Jesang Yoon
node.js 실무 - node js in practice by Jesang Yoonnode.js 실무 - node js in practice by Jesang Yoon
node.js 실무 - node js in practice by Jesang YoonJesang Yoon
 
Django deployment with PaaS
Django deployment with PaaSDjango deployment with PaaS
Django deployment with PaaSAppsembler
 
IPhone Web Development With Grails from CodeMash 2009
IPhone Web Development With Grails from CodeMash 2009IPhone Web Development With Grails from CodeMash 2009
IPhone Web Development With Grails from CodeMash 2009Christopher Judd
 

Similar to Spring boot 3g (20)

JVM Web Frameworks Exploration
JVM Web Frameworks ExplorationJVM Web Frameworks Exploration
JVM Web Frameworks Exploration
 
Groovy & Grails
Groovy & GrailsGroovy & Grails
Groovy & Grails
 
dJango
dJangodJango
dJango
 
Workflow automation for Front-end web applications
Workflow automation for Front-end web applicationsWorkflow automation for Front-end web applications
Workflow automation for Front-end web applications
 
Magic with groovy & grails
Magic with groovy & grailsMagic with groovy & grails
Magic with groovy & grails
 
Lean microservices through ahead of time compilation (Tobias Piper, Loveholid...
Lean microservices through ahead of time compilation (Tobias Piper, Loveholid...Lean microservices through ahead of time compilation (Tobias Piper, Loveholid...
Lean microservices through ahead of time compilation (Tobias Piper, Loveholid...
 
Google App Engine for Java
Google App Engine for JavaGoogle App Engine for Java
Google App Engine for Java
 
Java to Golang: An intro by Ryan Dawson Seldon.io
Java to Golang: An intro by Ryan Dawson Seldon.ioJava to Golang: An intro by Ryan Dawson Seldon.io
Java to Golang: An intro by Ryan Dawson Seldon.io
 
Airflow - a data flow engine
Airflow - a data flow engineAirflow - a data flow engine
Airflow - a data flow engine
 
Ratpack - Classy and Compact Groovy Web Apps
Ratpack - Classy and Compact Groovy Web AppsRatpack - Classy and Compact Groovy Web Apps
Ratpack - Classy and Compact Groovy Web Apps
 
Google App Engine for Java
Google App Engine for JavaGoogle App Engine for Java
Google App Engine for Java
 
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
 
Why Gradle?
Why Gradle?Why Gradle?
Why Gradle?
 
CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...
CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...
CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...
 
The 90-Day Startup with Google AppEngine for Java
The 90-Day Startup with Google AppEngine for JavaThe 90-Day Startup with Google AppEngine for Java
The 90-Day Startup with Google AppEngine for Java
 
GWT is Smarter Than You
GWT is Smarter Than YouGWT is Smarter Than You
GWT is Smarter Than You
 
node.js 실무 - node js in practice by Jesang Yoon
node.js 실무 - node js in practice by Jesang Yoonnode.js 실무 - node js in practice by Jesang Yoon
node.js 실무 - node js in practice by Jesang Yoon
 
Django deployment with PaaS
Django deployment with PaaSDjango deployment with PaaS
Django deployment with PaaS
 
IPhone Web Development With Grails from CodeMash 2009
IPhone Web Development With Grails from CodeMash 2009IPhone Web Development With Grails from CodeMash 2009
IPhone Web Development With Grails from CodeMash 2009
 
AppengineJS
AppengineJSAppengineJS
AppengineJS
 

Recently uploaded

Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Bhuvaneswari Subramani
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 

Recently uploaded (20)

Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 

Spring boot 3g

  • 1. SpringBoot + Groovy, Gorm, Gradle Presented by: Vasu Srinivasan, Texas NIC Usa For: Austin Groovy-Grails User Group (AGGUG), 2014-06-12
  • 2. about:me  Vasu Srinivasan  Sr Tech Consultant at Texas NIC, USA  Twitter: @vasya10  Blog: http://vasya10.wordpress.com  Slides: http://www.slideshare.net/vasya10/  Videos:  Battle of Programming Languages -https://www.youtube.com/watch?v=dKftGfU0giA  Along with Eric Kelm (@asoftwareguy, asoftwareguy.com)  Current interests  Grails/Groovy, AngularJS, SharePoint, Java, MongoDB, NodeJs
  • 3. about:Texas NIC, USA  NIC is in 29 states, specializing in e-government  scrum teams  Grails, SpringBoot, Spring, Oracle SOA, SharePoint, .Net stack  major applications  www.texas.gov  licensing applications  driver license renewals and reinstatements  concealed handgun  occupational and renewal licenses  birth and death certificates  vehicle inspections  texas department of criminal justice - Inmates App  and many many more!  our work benefits and impacts Texans directly
  • 4.
  • 5. why-not:spring  scalability has become a key issue for enterprise applications  stateless services provide better scalability  stand-alone monolithic servlet container and cluster management has in some cases become a specialized job (WebSphere anyone?)  a simple http server is sufficient for many small-to-medium applications  how application is deployed, forces how to write code  conceptually this will not change, but a certain level of freedom goes a long way in maintenance and extensibility  ramp up time to create a simple starter app is pretty high  many modern web frameworks have < 5 minutes to download the libraries and create a simple application
  • 6. why:spring-boot  xml as a configuration – an idea’s time has passed (long ago)  obviously verbose, bloated and error-prone  many post-Spring web frameworks use zero xml for configuration  Rails, Grails, Play, Wicket, etc.  ramp up time is a very important criteria  Play? play install run !  Or Grails? grails create-app !  opinionated frameworks are becoming fashionable, again?  Spring had to do something to compete with fast evolving frameworks such as DropWizard, Ratpack, Sinatra, Scalatra with the concept of “micro- services architecture” (MSA)  With its vast supporting frameworks/libraries including a solid DI mechanism, it needed a simple way to tie them all
  • 7. opinionated frameworks  frameworks that have strong opinions about themselves  framework by developers who have strong opinions about what goes in
  • 8. why:boot  spring booted xml out: so “SpringBoot”  of course, that’s the unofficial version of the story
  • 9. about:spring-boot  container project for creating new Spring based applications  embedded servlet container: Tomcat or Jetty  starter POMs for many libraries (web, jdbc, log, data etc)  auto configurations  actuators (health, metrics, beans, shutdown, ssh, etc.)  xml, java annotated, groovy bean configurations  xml configuration not mandatory anymore  supports many dbs via spring-data  helps blend web and non-web (eg. batch) functionality  supports many views  jsp (limited), thymeleaf, and groovy template engine too! (1.1.0)
  • 10. using:groovy  traditional Spring apps are mostly in Java, but Groovy is a smoother, richer language  Groovy enriches Spring Boot in many ways
  • 11. using:boot-with-groovy Groovy in Boot How? Using spring-cli, run Groovy scripts spring run app.groovy but would anyone do this in prod? not sure. Use groovy as the language, instead of Java, the language apply plugin: ‘groovy’ compile (“org.codehaus.groovy:groovy:$groovyVersion) Use Groovy Bean configuration instead of xml Boot’s GroovyBeanDefinitionReader wires the beans Just like Grails resources.groovy Use Groovy Template Engine since Boot 1.1.0 and Groovy 2.3.2 easy to create html via markup template. templates in src/main/resources/templates/*.tpl practical in cases where html is an overkill (email templates, display history data etc.) compile "org.codehaus.groovy:groovy- templates:${groovyVersion}" Using Gorm Spin-off from Grails compile("org.grails:gorm-hibernate4-spring- boot:1.0.0.GA")
  • 12. using:boot-with-groovy highlights  Some immediate advantages using Groovy  Practical and time-saving annotations  @ToString, @Log, @EqualsAndHashCode  Faster Json conversions (with Groovy 2.3)  Null-safe operations  Groovy Strings  Test using Spock  Many classes can apply @CompileStatic and be as fast as Java
  • 13. spring-boot:demo1  Starter Project – Spring Initializer  start.spring.io  add required poms, select “Gradle Project”  unzip the downloaded file  Add default gradle wrapper artifacts  Fix Application.groovy  Add logback.groovy  gradlew clean bootRun  In Mac/Linux use gvm, lazybones  http://www.nautsch.net/2014/04/15/spring-boot-running-in-2-min/
  • 14. spring-boot:demo1  Actuators  /beans  /metrics  /health  /shutdown  /trace  /dump  Auto-configures database for HSQL DB  Auto-configures a bunch of other beans  Adds a default Tomcat servlet container to run on port 8080
  • 15. spring-boot:demo2  Star Catalog  Simple Rest Service (Get and Post)  AngularJS as client  Batch Processing  Groovy Bean Configuration  Groovy Template Engine as View layer
  • 17. spring-boot:good  traditional Spring MVC (xml) developers will surely see advantages in reduced / manual configurations  rest made easy  deployment made easy  auto-configurations largely reduce initial dependency management  java annotated configurations provide type- safety check  well modularized, instead of a “kitchen-sink” approach  gradle support is awesome
  • 18. spring-boot:baffling  Multiple ways to setup properties  application.properties, application.yml  Decide on early. Go YAML.  Too many logging frameworks are included in classpath  Strongly recommend to use logback as standard, logback.groovy works fine  No out of the box support for profiles  Grails by default provides environment blocks in the configurations, making it super easy to configure for different environments  In SpringBoot, some handcraft is required to create profiles (development section in yml or application-development.properties)  Power of grailsApplication.config will be missed
  • 19. spring-boot:baffling  Too many @configuration related annotations  @AutoConfigure, @Configuration, @EnableConfiguration, @EnableConfigurationProperties, @ConfigurationProperties, @PropertySource, @Value  Annotations cannot be intuitively applied, reference documentation is the main guide  Too many annotations in general – sometimes I wonder what is my business logic (@Bean, @PostConstruct, @ComponentScan)  once you get past the auto-configuration magic, overriding the configurations takes a bit of discovery time  what to wire?  what properties are required?
  • 20. spring-boot:baffling  what are my views?  jsp (anyone still using this???!)  thymeleaf (good and clean library)  groovy template engine  gsp (stand-alone spin-off from grails)  where are my views?  recommended path is src/main/resources/static  too deep in the IDE view  IDE settings can mistake static to be a java package, resulting in undesirable refactors (rename for eg)  or use webjars for javascript jars  UI Team may like to use bower like js dependency package tools  are webjars always current?  need build customizations if using bower, sass  no out of box support (yet) or grails plugin like asset-pipeline (opportunity to develop!)
  • 21. spring-boot:unexpected  Grails Domain objects cannot be converted to Json directly  needs a custom mapper in between  Not all xml configuration enhancements translate to Groovy Bean DSL  eg. <ctx:annotation-config/> works  but not <batch:/>  Broke in Spring Boot 1.1.x  Gorm @Transactional is broke – throws Proxy error  Gorm methods are not available at startup time (Bootstrap/InitializingBean)  substitute with a manual restful controller initiated call to initialize records
  • 22. spring-boot:ide tricks (IntelliJ)  run the main application directly, not via gradle bootRun  For debugging add VM option  -javaagent:/path/springloaded-1.2.0.RELEASE.jar -noverify  then, debug the main application  sometimes port is not released (Windows)  netstat –o –a –n | findstr “8080”  stop-process $id  Associate groovy template .tpl files with “Groovy” for auto-formatting
  • 23. spring-boot:nice-to-have  faster creation of project templates, instead of browser  groovy configuration support (like .properties, .yaml)  richer runtime evaluations, environment block support  out of the box support for common active profiles  expose entities as Rest Entities for prototypes (like Grails @Resource)  tooling support for Groovy Bean DSL and GTE  Well, perhaps they are already in the making … ?  grails-boot?
  • 24. spring-boot:should we?  already a heavily invested traditional Spring shop?  desperately want to scale your apps now?  xml configurations giving you nightmares or headaches?  want a better deployment strategy?  want to hop on the micro-services wagon?  can’t wait for grails-boot?  all of the above?  any one of the above?
  • 25. Links, References, Acknowledgements  Spring Initializr - http://start.spring.io  http://www.infoq.com/articles/microservices-intro  http://docs.spring.io/spring-boot/docs/current- SNAPSHOT/reference/htmlsingle/  Demo Application (StarCatalog) - https://github.com/vasya10/spring-boot- batch-sample  Testing SpringBoot with Spock - http://fbflex.wordpress.com/2013/09/18/testing-spring-boot-applications- with-spock/  Google Image search for cute Puss in Boots images  Disney / Dreamworks for Puss in Boots images  Images are used in good intention only to illustrate context of topic
  • 26. Thank you! Austin Groovy/Grails User Group ReachForce, Austin Texas NIC, Austin (Sponsor) SpringBoot, Groovy, Grails, Gradle team!