SlideShare a Scribd company logo
1 of 35
Download to read offline
Spring Roo 2.0
César Ordiñana & Enrique Ruiz
Spring Roo 2.0 Preview
What is Spring Roo
Current GA release: Spring Roo 1.3.2
What’s new in Spring Roo 2.0
Live demo
What is Spring Roo?
An easy-to-use development tool for quickly building web
applications in the Java programming language
_ _ _ _ _ _ _ _ _ _ _ _
/ _ _  / _ _  / _ _ 
/ / _ / / / / / / / /
/ _ , _ / / _ / / / _ / /
/ _ / | _ |  _ _ _ _ /  _ _ _ _ / 2 . 0 . 0 . M 2
W e l c o m e t o S p r i n g R o o . F o r a s s i s t a n c e p r e s s T A B o r t y p e " h i n t " t h e n h i t E N T E R .
S p r i n g R o o E a s t e r n G r e y U I s t a r t e d a t ' h t t p : / / l o c a l h o s t : 9 1 9 1 / '
r o o >
What Spring Roo is NOT
Spring Roo is not a framework, it is not used in runtime.
Spring Roo engine features
Code generation engine
Programmers code (.java) isolated from generated code
(.aj)
Roo will never overwrite programmers code
Passive and active code generation
Runtime performance not affected by Roo
Why use it?
Higher productivity
Stock-Standard Java and Spring
Bootstraping, maintenance and evolution
Spring Roo 1.x
Applications based on
old technologies
Deprecated
architecture Active
Record
Generated code should
be easier to customize
Extremely simple UI
Basic REST support
Spring Roo 2.0: a new
philosophy
Focused on newer Spring technologies
Create Spring Boot applications
Java-based configuration model
Generate as few code as possible
Easier code customization
Thymeleaf view layer
Demo: New features
Spring IO platform and Boot applications
Global project settings
Conditional command parameters
push-in command
Full support for Spring Data repositories
Improved REST services
New view: Thymeleaf, Bootstrap and JQuery datatables
Create a new project
New > Project > Spring Roo
r o o > p r o j e c t s e t u p - - t o p L e v e l P a c k a g e o r g . s p r i n g i o . t i c k e t
- - p r o j e c t N a m e " S p r i n g I O T i c k e t s " - - j a v a 8 - - p a c k a g i n g J A R
Spring IO and Boot
application
Spring IO and Boot in the pom.xml
Main Boot Application class
Data Access Layer
r o o > j p a s e t u p - - p r o v i d e r H I B E R N A T E - - d a t a b a s e P O S T G R E S - -
j p a s e t u p - - p r o v i d e r H I B E R N A T E - - d a t a b a s e P O S T G R E S - - d a t a b a s e N a m e
j p a s e t u p - - p r o v i d e r H I B E R N A T E - - d a t a b a s e P O S T G R E S - - f o r c e
j p a s e t u p - - p r o v i d e r H I B E R N A T E - - d a t a b a s e P O S T G R E S - - h o s t N a m e
j p a s e t u p - - p r o v i d e r H I B E R N A T E - - d a t a b a s e P O S T G R E S - - j n d i D a t a S o u r c e
j p a s e t u p - - p r o v i d e r H I B E R N A T E - - d a t a b a s e P O S T G R E S - - p a s s w o r d
j p a s e t u p - - p r o v i d e r H I B E R N A T E - - d a t a b a s e P O S T G R E S - - p r o f i l e
j p a s e t u p - - p r o v i d e r H I B E R N A T E - - d a t a b a s e P O S T G R E S - - u s e r N a m e
Improved usability
r o o > j p a s e t u p - - p r o v i d e r H I B E R N A T E - - d a t a b a s e H 2 _ I N _ M E M O R Y - -
j p a s e t u p - - p r o v i d e r H I B E R N A T E - - d a t a b a s e H 2 _ I N _ M E M O R Y - - f o r c e
j p a s e t u p - - p r o v i d e r H I B E R N A T E - - d a t a b a s e H 2 _ I N _ M E M O R Y - - p r o f i l e
r o o > j p a s e t u p - - p r o v i d e r H I B E R N A T E - - d a t a b a s e H 2 _ I N _ M E M O R Y
Domain model
Easily create your JPA domain model with the entity jpa
and field add commands.
r o o > e n t i t y j p a - - c l a s s ~ . m o d e l . T i c k e t
~ . m o d e l . T i c k e t r o o > f i e l d s t r i n g - - f i e l d N a m e n a m e
- - c o m m e n t " T h e t i c k e t ' s n a m e " - - n o t N u l l
- - s i z e M i n 5 - - s i z e M a x 2 0
@ M i n ( 1 )
@ M a x ( 1 0 0 0 )
p r i v a t e I n t e g e r q u a n t i t y ;
~ . m o d e l . T i c k e t r o o > f i e l d n u m b e r - - f i e l d N a m e p r i c e
- - t y p e j a v a . l a n g . I n t e g e r
- - c o m m e n t " T h e s e l l i n g p r i c e "
- - m i n 0 - - m a x 1 0 0 0
Tests
Create a unit test
r o o > t e s t u n i t - - c l a s s ~ . m o d e l . T i c k e t
Customize the code
Overwrite Roo generated methods
TicketTest.java
p u b l i c c l a s s T i c k e t T e s t {
p r i v a t e T i c k e t t i c k e t ;
@ B e f o r e p u b l i c v o i d s e t u p ( ) {
t h i s . t i c k e t = n e w T i c k e t ( ) ;
t h i s . t i c k e t . s e t N a m e ( " E a r l y B i r d " ) ;
t h i s . t i c k e t . s e t Q u a n t i t y ( 7 5 ) ;
t h i s . t i c k e t . s e t P r i c e ( 2 1 9 ) ;
t h i s . t i c k e t . s e t I d ( 1 l ) ;
t h i s . t i c k e t . s e t V e r s i o n ( 1 ) ;
}
}
Customize the code (II)
Create your own methods
TicketTest.java
p u b l i c c l a s s T i c k e t T e s t {
@ T e s t
p u b l i c v o i d c h e c k T o S t r i n g C r e a t e s E x p e c t e d V a l u e ( ) {
a s s e r t E q u a l s ( " E a r l y B i r d , 7 5 , 2 1 9 , 1 , 1 " ,
t i c k e t . t o S t r i n g ( ) ) ;
}
}
Customize the code (III)
New command: push-in
r o o > p u s h - i n - - c l a s s ~ . m o d e l . T i c k e t - - m e t h o d t o S t r i n g
Test.java
p u b l i c S t r i n g t o S t r i n g ( ) {
r e t u r n R e f l e c t i o n T o S t r i n g B u i l d e r . t o S t r i n g ( t h i s ,
T o S t r i n g S t y l e . S I M P L E _ S T Y L E ) ;
}
Project settings
Define the project standards and let Roo control them for
you
r o o > s e t t i n g s a d d - - n a m e s p r i n g . r o o . j p a . r e q u i r e . s c h e m a - o b j e c t - n a m e
- - v a l u e t r u e
r o o > e n t i t y j p a - - c l a s s ~ . m o d e l . C u s t o m e r
Y o u m u s t s p e c i f y o p t i o n ' t a b l e ' f o r t h i s c o m m a n d
More domain model
Ticket → Customer
r o o > s c r i p t - - f i l e ~ / E s c r i t o r i o / c u s t o m e r s . r o o
Repository
r o o > r e p o s i t o r y j p a - - e n t i t y ~ . m o d e l . T i c k e t
r o o > r e p o s i t o r y j p a - - a l l - - p a c k a g e ~ . r e p o s i t o r y
Repository queries
r o o > f i n d e r a d d - - c l a s s ~ . m o d e l . T i c k e t
- - n a m e f i n d B y A v a i l a b l e G r e a t e r T h a n A n d N a m e C o n t a i n i n g O r d e r B y N a m e A s c
Service Layer
r o o > s e r v i c e - - e n t i t y ~ . m o d e l . T i c k e t
- - r e p o s i t o r y ~ . m o d e l . T i c k e t R e p o s i t o r y
- - i n t e r f a c e ~ . s e r v i c e . T i c k e t S e r v i c e
r o o > s e r v i c e - - a l l - - a p i P a c k a g e ~ . s e r v i c e . a p i
- - i m p l P a c k a g e ~ . s e r v i c e . i m p l
Your business logic
r o o > p u s h - i n - - c l a s s ~ . s e r v i c e . i m p l . C u s t o m e r S e r v i c e I m p l - - m e t h o d s a v e
CustomerServiceImpl.java
p r i v a t e f i n a l T i c k e t S e r v i c e t i c k e t S e r v i c e ;
@ A u t o w i r e d
p u b l i c C u s t o m e r S e r v i c e I m p l ( C u s t o m e r R e p o s i t o r y c u s t o m e r R e p o s i t o r y ,
T i c k e t S e r v i c e t i c k e t S e r v i c e ) {
t h i s . c u s t o m e r R e p o s i t o r y = c u s t o m e r R e p o s i t o r y ;
t h i s . t i c k e t S e r v i c e = t i c k e t S e r v i c e ;
}
p r i v a t e v o i d u p d a t e T i c k e t Q u a n t i t y ( C u s t o m e r e n t i t y ) {
i f ( e n t i t y . g e t I d ( ) ! = n u l l ) {
T i c k e t t i c k e t = e n t i t y . g e t T i c k e t ( ) ;
t i c k e t . s e t Q u a n t i t y ( t i c k e t . g e t Q u a n t i t y ( ) - 1 ) ;
t i c k e t S e r v i c e . s a v e ( t i c k e t ) ;
}
}
Your business logic (II)
CustomerServiceImpl.java
@ T r a n s a c t i o n a l ( r e a d O n l y = f a l s e )
p u b l i c C u s t o m e r s a v e ( C u s t o m e r e n t i t y ) {
u p d a t e T i c k e t Q u a n t i t y ( e n t i t y ) ;
r e t u r n c u s t o m e r R e p o s i t o r y . s a v e ( e n t i t y ) ;
}
@ T r a n s a c t i o n a l ( r e a d O n l y = f a l s e )
p u b l i c L i s t < C u s t o m e r > s a v e ( I t e r a b l e < C u s t o m e r > e n t i t i e s ) {
f o r ( C u s t o m e r c u s t o m e r : e n t i t i e s ) {
u p d a t e T i c k e t Q u a n t i t y ( c u s t o m e r ) ;
}
r e t u r n c u s t o m e r R e p o s i t o r y . s a v e ( e n t i t i e s ) ;
}
Presentation Layer
You choose:
Control only → REST Services
Control and View → REST Services + Thymeleaf
Adding web support
w e b m v c s e t u p
REST Services
w e b m v c c o n t r o l l e r - - a l l - - p a c k a g e ~ . w e b
Generating the view
w e b m v c v i e w s e t u p - - t y p e T H Y M E L E A F
Customize the views
w e b m v c t e m p l a t e s s e t u p - - t y p e T H Y M E L E A F
Views and handler
methods
w e b m v c c o n t r o l l e r - - a l l - - p a c k a g e ~ . w e b - - r e s p o n s e T y p e T H Y M E L E A F
Powerful code generation
f i e l d s t r i n g - - f i e l d N a m e d e s c r i p t i o n
Roadmap
DTOs code generation
Non-CRUD REST services
Integration layer
Security layer
Auditing of persistent classes
WebJars integration
UI widgets
Questions?
 http://projects.spring.io/spring-roo/
 https://github.com/spring-projects/spring-roo
 http://stackoverflow.com/questions/tagged/spring-roo
 https://twitter.com/SpringRoo
 http://www.disid.com
Roo it!
Create your Boot applications with Spring Roo 2!

More Related Content

What's hot

Francis cv 27 05-2013
Francis cv 27 05-2013Francis cv 27 05-2013
Francis cv 27 05-2013
Francis Bell
 
military training
military trainingmilitary training
military training
Kelvin Xuna
 
Niles West v Glenbrook South 1984
Niles West v Glenbrook South 1984Niles West v Glenbrook South 1984
Niles West v Glenbrook South 1984
Dave Levine
 

What's hot (20)

PROJECT STORYBOARD: Increasing First Run Parts From 60% to 90%
PROJECT STORYBOARD: Increasing First Run Parts From 60% to 90%PROJECT STORYBOARD: Increasing First Run Parts From 60% to 90%
PROJECT STORYBOARD: Increasing First Run Parts From 60% to 90%
 
Company Profile 2014 (Before Rebranding)
Company Profile 2014 (Before Rebranding)Company Profile 2014 (Before Rebranding)
Company Profile 2014 (Before Rebranding)
 
Robotic Process Automation (RPA)_Harvesting a Competitive Advantage
Robotic Process Automation (RPA)_Harvesting a Competitive AdvantageRobotic Process Automation (RPA)_Harvesting a Competitive Advantage
Robotic Process Automation (RPA)_Harvesting a Competitive Advantage
 
Towards Exemplary Moodle Courses at YSJU
Towards Exemplary Moodle Courses at YSJUTowards Exemplary Moodle Courses at YSJU
Towards Exemplary Moodle Courses at YSJU
 
Google clarified structured data's effect on SEO
Google clarified structured data's effect on SEOGoogle clarified structured data's effect on SEO
Google clarified structured data's effect on SEO
 
AUDIT TRAIL AND TRACEABLILTY OF PRODUCTS
AUDIT TRAIL AND TRACEABLILTY OF PRODUCTSAUDIT TRAIL AND TRACEABLILTY OF PRODUCTS
AUDIT TRAIL AND TRACEABLILTY OF PRODUCTS
 
Analysis by shloka
Analysis by shlokaAnalysis by shloka
Analysis by shloka
 
Francis cv 27 05-2013
Francis cv 27 05-2013Francis cv 27 05-2013
Francis cv 27 05-2013
 
Understanding Online Consumer Behavior in Fashion E-commerce by the applicati...
Understanding Online Consumer Behavior in Fashion E-commerce by the applicati...Understanding Online Consumer Behavior in Fashion E-commerce by the applicati...
Understanding Online Consumer Behavior in Fashion E-commerce by the applicati...
 
A Comparative Study of Data Management Maturity Models
A Comparative Study of Data Management Maturity ModelsA Comparative Study of Data Management Maturity Models
A Comparative Study of Data Management Maturity Models
 
military training
military trainingmilitary training
military training
 
Accounting Class Project - Creating a Private Placement Memorandum
Accounting Class Project - Creating a Private Placement MemorandumAccounting Class Project - Creating a Private Placement Memorandum
Accounting Class Project - Creating a Private Placement Memorandum
 
A Comparative Study of Data Management Maturity Models
A Comparative Study of Data Management Maturity ModelsA Comparative Study of Data Management Maturity Models
A Comparative Study of Data Management Maturity Models
 
How IBM API Management use Informix and NoSQL
How IBM API Management use Informix and NoSQLHow IBM API Management use Informix and NoSQL
How IBM API Management use Informix and NoSQL
 
Why the org_matters_shorter.jzt.2018sept25
Why the org_matters_shorter.jzt.2018sept25Why the org_matters_shorter.jzt.2018sept25
Why the org_matters_shorter.jzt.2018sept25
 
How Consumers use Digital Technology
How Consumers use Digital TechnologyHow Consumers use Digital Technology
How Consumers use Digital Technology
 
Niles West v Glenbrook South 1984
Niles West v Glenbrook South 1984Niles West v Glenbrook South 1984
Niles West v Glenbrook South 1984
 
estimaing assignment
estimaing assignmentestimaing assignment
estimaing assignment
 
Hrm hrp 2012
Hrm hrp 2012Hrm hrp 2012
Hrm hrp 2012
 
MICE in Abu Dhabi
MICE in Abu Dhabi MICE in Abu Dhabi
MICE in Abu Dhabi
 

Similar to Spring Roo 2.0 Preview at Spring I/O 2016

Newest copy _rockstar solutions
Newest copy _rockstar solutionsNewest copy _rockstar solutions
Newest copy _rockstar solutions
joyousone1104
 
Testing Fuse Fabric with Pax Exam
Testing Fuse Fabric with Pax ExamTesting Fuse Fabric with Pax Exam
Testing Fuse Fabric with Pax Exam
Henryk Konsek
 
E xact micro 10 photometer v4
E xact micro 10 photometer v4E xact micro 10 photometer v4
E xact micro 10 photometer v4
Ronnie Lewis
 

Similar to Spring Roo 2.0 Preview at Spring I/O 2016 (20)

Breathe life into your designer!
Breathe life into your designer!Breathe life into your designer!
Breathe life into your designer!
 
Piotr Szotkowski about "Ruby smells"
Piotr Szotkowski about "Ruby smells"Piotr Szotkowski about "Ruby smells"
Piotr Szotkowski about "Ruby smells"
 
PyLadies Talk: Learn to love the command line!
PyLadies Talk: Learn to love the command line!PyLadies Talk: Learn to love the command line!
PyLadies Talk: Learn to love the command line!
 
Design and Fabrication for Motorized Automated Screw Jack
Design and Fabrication for Motorized Automated Screw JackDesign and Fabrication for Motorized Automated Screw Jack
Design and Fabrication for Motorized Automated Screw Jack
 
Meteor - not just for rockstars
Meteor - not just for rockstarsMeteor - not just for rockstars
Meteor - not just for rockstars
 
Newest copy _rockstar solutions
Newest copy _rockstar solutionsNewest copy _rockstar solutions
Newest copy _rockstar solutions
 
eHarmony @ Phoenix Con 2016
eHarmony @ Phoenix Con 2016eHarmony @ Phoenix Con 2016
eHarmony @ Phoenix Con 2016
 
cofaso Presentation
cofaso Presentationcofaso Presentation
cofaso Presentation
 
Testing Fuse Fabric with Pax Exam
Testing Fuse Fabric with Pax ExamTesting Fuse Fabric with Pax Exam
Testing Fuse Fabric with Pax Exam
 
1-SYSTEM-ANALYSIS-AND-DESIGN-INTRODUCTION.pptx
1-SYSTEM-ANALYSIS-AND-DESIGN-INTRODUCTION.pptx1-SYSTEM-ANALYSIS-AND-DESIGN-INTRODUCTION.pptx
1-SYSTEM-ANALYSIS-AND-DESIGN-INTRODUCTION.pptx
 
Creating Modern Metadata Systems with New Relic, Dow Jones [FutureStack16]
Creating Modern Metadata Systems with New Relic, Dow Jones [FutureStack16]Creating Modern Metadata Systems with New Relic, Dow Jones [FutureStack16]
Creating Modern Metadata Systems with New Relic, Dow Jones [FutureStack16]
 
Code GPU with CUDA - Identifying performance limiters
Code GPU with CUDA - Identifying performance limitersCode GPU with CUDA - Identifying performance limiters
Code GPU with CUDA - Identifying performance limiters
 
Meteor WWNRW Intro
Meteor WWNRW IntroMeteor WWNRW Intro
Meteor WWNRW Intro
 
Running Puppet In Stand Alone Mode
Running Puppet In Stand Alone ModeRunning Puppet In Stand Alone Mode
Running Puppet In Stand Alone Mode
 
Writing (Meteor) Code With Style
Writing (Meteor) Code With StyleWriting (Meteor) Code With Style
Writing (Meteor) Code With Style
 
Customer_Testimonial_IFFCO.pdf
Customer_Testimonial_IFFCO.pdfCustomer_Testimonial_IFFCO.pdf
Customer_Testimonial_IFFCO.pdf
 
E xact micro 10 photometer v4
E xact micro 10 photometer v4E xact micro 10 photometer v4
E xact micro 10 photometer v4
 
Taxmann's GST Mini Ready Reckoner | July 2020
Taxmann's GST Mini Ready Reckoner | July 2020Taxmann's GST Mini Ready Reckoner | July 2020
Taxmann's GST Mini Ready Reckoner | July 2020
 
Fast api
Fast apiFast api
Fast api
 
Web Development for Managers
Web Development for ManagersWeb Development for Managers
Web Development for Managers
 

Recently uploaded

introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Recently uploaded (20)

The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 

Spring Roo 2.0 Preview at Spring I/O 2016

  • 1. Spring Roo 2.0 César Ordiñana & Enrique Ruiz
  • 2. Spring Roo 2.0 Preview What is Spring Roo Current GA release: Spring Roo 1.3.2 What’s new in Spring Roo 2.0 Live demo
  • 3. What is Spring Roo? An easy-to-use development tool for quickly building web applications in the Java programming language _ _ _ _ _ _ _ _ _ _ _ _ / _ _ / _ _ / _ _ / / _ / / / / / / / / / _ , _ / / _ / / / _ / / / _ / | _ | _ _ _ _ / _ _ _ _ / 2 . 0 . 0 . M 2 W e l c o m e t o S p r i n g R o o . F o r a s s i s t a n c e p r e s s T A B o r t y p e " h i n t " t h e n h i t E N T E R . S p r i n g R o o E a s t e r n G r e y U I s t a r t e d a t ' h t t p : / / l o c a l h o s t : 9 1 9 1 / ' r o o >
  • 4. What Spring Roo is NOT Spring Roo is not a framework, it is not used in runtime.
  • 5. Spring Roo engine features Code generation engine Programmers code (.java) isolated from generated code (.aj) Roo will never overwrite programmers code Passive and active code generation Runtime performance not affected by Roo
  • 6. Why use it? Higher productivity Stock-Standard Java and Spring Bootstraping, maintenance and evolution
  • 7. Spring Roo 1.x Applications based on old technologies Deprecated architecture Active Record Generated code should be easier to customize Extremely simple UI Basic REST support
  • 8. Spring Roo 2.0: a new philosophy Focused on newer Spring technologies Create Spring Boot applications Java-based configuration model Generate as few code as possible Easier code customization Thymeleaf view layer
  • 9. Demo: New features Spring IO platform and Boot applications Global project settings Conditional command parameters push-in command Full support for Spring Data repositories Improved REST services New view: Thymeleaf, Bootstrap and JQuery datatables
  • 10. Create a new project New > Project > Spring Roo r o o > p r o j e c t s e t u p - - t o p L e v e l P a c k a g e o r g . s p r i n g i o . t i c k e t - - p r o j e c t N a m e " S p r i n g I O T i c k e t s " - - j a v a 8 - - p a c k a g i n g J A R
  • 11. Spring IO and Boot application Spring IO and Boot in the pom.xml Main Boot Application class
  • 12. Data Access Layer r o o > j p a s e t u p - - p r o v i d e r H I B E R N A T E - - d a t a b a s e P O S T G R E S - - j p a s e t u p - - p r o v i d e r H I B E R N A T E - - d a t a b a s e P O S T G R E S - - d a t a b a s e N a m e j p a s e t u p - - p r o v i d e r H I B E R N A T E - - d a t a b a s e P O S T G R E S - - f o r c e j p a s e t u p - - p r o v i d e r H I B E R N A T E - - d a t a b a s e P O S T G R E S - - h o s t N a m e j p a s e t u p - - p r o v i d e r H I B E R N A T E - - d a t a b a s e P O S T G R E S - - j n d i D a t a S o u r c e j p a s e t u p - - p r o v i d e r H I B E R N A T E - - d a t a b a s e P O S T G R E S - - p a s s w o r d j p a s e t u p - - p r o v i d e r H I B E R N A T E - - d a t a b a s e P O S T G R E S - - p r o f i l e j p a s e t u p - - p r o v i d e r H I B E R N A T E - - d a t a b a s e P O S T G R E S - - u s e r N a m e
  • 13. Improved usability r o o > j p a s e t u p - - p r o v i d e r H I B E R N A T E - - d a t a b a s e H 2 _ I N _ M E M O R Y - - j p a s e t u p - - p r o v i d e r H I B E R N A T E - - d a t a b a s e H 2 _ I N _ M E M O R Y - - f o r c e j p a s e t u p - - p r o v i d e r H I B E R N A T E - - d a t a b a s e H 2 _ I N _ M E M O R Y - - p r o f i l e r o o > j p a s e t u p - - p r o v i d e r H I B E R N A T E - - d a t a b a s e H 2 _ I N _ M E M O R Y
  • 14. Domain model Easily create your JPA domain model with the entity jpa and field add commands. r o o > e n t i t y j p a - - c l a s s ~ . m o d e l . T i c k e t ~ . m o d e l . T i c k e t r o o > f i e l d s t r i n g - - f i e l d N a m e n a m e - - c o m m e n t " T h e t i c k e t ' s n a m e " - - n o t N u l l - - s i z e M i n 5 - - s i z e M a x 2 0 @ M i n ( 1 ) @ M a x ( 1 0 0 0 ) p r i v a t e I n t e g e r q u a n t i t y ; ~ . m o d e l . T i c k e t r o o > f i e l d n u m b e r - - f i e l d N a m e p r i c e - - t y p e j a v a . l a n g . I n t e g e r - - c o m m e n t " T h e s e l l i n g p r i c e " - - m i n 0 - - m a x 1 0 0 0
  • 15. Tests Create a unit test r o o > t e s t u n i t - - c l a s s ~ . m o d e l . T i c k e t
  • 16. Customize the code Overwrite Roo generated methods TicketTest.java p u b l i c c l a s s T i c k e t T e s t { p r i v a t e T i c k e t t i c k e t ; @ B e f o r e p u b l i c v o i d s e t u p ( ) { t h i s . t i c k e t = n e w T i c k e t ( ) ; t h i s . t i c k e t . s e t N a m e ( " E a r l y B i r d " ) ; t h i s . t i c k e t . s e t Q u a n t i t y ( 7 5 ) ; t h i s . t i c k e t . s e t P r i c e ( 2 1 9 ) ; t h i s . t i c k e t . s e t I d ( 1 l ) ; t h i s . t i c k e t . s e t V e r s i o n ( 1 ) ; } }
  • 17. Customize the code (II) Create your own methods TicketTest.java p u b l i c c l a s s T i c k e t T e s t { @ T e s t p u b l i c v o i d c h e c k T o S t r i n g C r e a t e s E x p e c t e d V a l u e ( ) { a s s e r t E q u a l s ( " E a r l y B i r d , 7 5 , 2 1 9 , 1 , 1 " , t i c k e t . t o S t r i n g ( ) ) ; } }
  • 18. Customize the code (III) New command: push-in r o o > p u s h - i n - - c l a s s ~ . m o d e l . T i c k e t - - m e t h o d t o S t r i n g Test.java p u b l i c S t r i n g t o S t r i n g ( ) { r e t u r n R e f l e c t i o n T o S t r i n g B u i l d e r . t o S t r i n g ( t h i s , T o S t r i n g S t y l e . S I M P L E _ S T Y L E ) ; }
  • 19. Project settings Define the project standards and let Roo control them for you r o o > s e t t i n g s a d d - - n a m e s p r i n g . r o o . j p a . r e q u i r e . s c h e m a - o b j e c t - n a m e - - v a l u e t r u e r o o > e n t i t y j p a - - c l a s s ~ . m o d e l . C u s t o m e r Y o u m u s t s p e c i f y o p t i o n ' t a b l e ' f o r t h i s c o m m a n d
  • 20. More domain model Ticket → Customer r o o > s c r i p t - - f i l e ~ / E s c r i t o r i o / c u s t o m e r s . r o o
  • 21. Repository r o o > r e p o s i t o r y j p a - - e n t i t y ~ . m o d e l . T i c k e t r o o > r e p o s i t o r y j p a - - a l l - - p a c k a g e ~ . r e p o s i t o r y
  • 22. Repository queries r o o > f i n d e r a d d - - c l a s s ~ . m o d e l . T i c k e t - - n a m e f i n d B y A v a i l a b l e G r e a t e r T h a n A n d N a m e C o n t a i n i n g O r d e r B y N a m e A s c
  • 23. Service Layer r o o > s e r v i c e - - e n t i t y ~ . m o d e l . T i c k e t - - r e p o s i t o r y ~ . m o d e l . T i c k e t R e p o s i t o r y - - i n t e r f a c e ~ . s e r v i c e . T i c k e t S e r v i c e r o o > s e r v i c e - - a l l - - a p i P a c k a g e ~ . s e r v i c e . a p i - - i m p l P a c k a g e ~ . s e r v i c e . i m p l
  • 24. Your business logic r o o > p u s h - i n - - c l a s s ~ . s e r v i c e . i m p l . C u s t o m e r S e r v i c e I m p l - - m e t h o d s a v e CustomerServiceImpl.java p r i v a t e f i n a l T i c k e t S e r v i c e t i c k e t S e r v i c e ; @ A u t o w i r e d p u b l i c C u s t o m e r S e r v i c e I m p l ( C u s t o m e r R e p o s i t o r y c u s t o m e r R e p o s i t o r y , T i c k e t S e r v i c e t i c k e t S e r v i c e ) { t h i s . c u s t o m e r R e p o s i t o r y = c u s t o m e r R e p o s i t o r y ; t h i s . t i c k e t S e r v i c e = t i c k e t S e r v i c e ; } p r i v a t e v o i d u p d a t e T i c k e t Q u a n t i t y ( C u s t o m e r e n t i t y ) { i f ( e n t i t y . g e t I d ( ) ! = n u l l ) { T i c k e t t i c k e t = e n t i t y . g e t T i c k e t ( ) ; t i c k e t . s e t Q u a n t i t y ( t i c k e t . g e t Q u a n t i t y ( ) - 1 ) ; t i c k e t S e r v i c e . s a v e ( t i c k e t ) ; } }
  • 25. Your business logic (II) CustomerServiceImpl.java @ T r a n s a c t i o n a l ( r e a d O n l y = f a l s e ) p u b l i c C u s t o m e r s a v e ( C u s t o m e r e n t i t y ) { u p d a t e T i c k e t Q u a n t i t y ( e n t i t y ) ; r e t u r n c u s t o m e r R e p o s i t o r y . s a v e ( e n t i t y ) ; } @ T r a n s a c t i o n a l ( r e a d O n l y = f a l s e ) p u b l i c L i s t < C u s t o m e r > s a v e ( I t e r a b l e < C u s t o m e r > e n t i t i e s ) { f o r ( C u s t o m e r c u s t o m e r : e n t i t i e s ) { u p d a t e T i c k e t Q u a n t i t y ( c u s t o m e r ) ; } r e t u r n c u s t o m e r R e p o s i t o r y . s a v e ( e n t i t i e s ) ; }
  • 26. Presentation Layer You choose: Control only → REST Services Control and View → REST Services + Thymeleaf
  • 27. Adding web support w e b m v c s e t u p
  • 28. REST Services w e b m v c c o n t r o l l e r - - a l l - - p a c k a g e ~ . w e b
  • 29. Generating the view w e b m v c v i e w s e t u p - - t y p e T H Y M E L E A F
  • 30. Customize the views w e b m v c t e m p l a t e s s e t u p - - t y p e T H Y M E L E A F
  • 31. Views and handler methods w e b m v c c o n t r o l l e r - - a l l - - p a c k a g e ~ . w e b - - r e s p o n s e T y p e T H Y M E L E A F
  • 32. Powerful code generation f i e l d s t r i n g - - f i e l d N a m e d e s c r i p t i o n
  • 33. Roadmap DTOs code generation Non-CRUD REST services Integration layer Security layer Auditing of persistent classes WebJars integration UI widgets
  • 34. Questions?  http://projects.spring.io/spring-roo/  https://github.com/spring-projects/spring-roo  http://stackoverflow.com/questions/tagged/spring-roo  https://twitter.com/SpringRoo  http://www.disid.com
  • 35. Roo it! Create your Boot applications with Spring Roo 2!