SlideShare a Scribd company logo
Photos by

#NoXML: Eliminating XML in Spring Projects
Matt Raible • http://raibledesigns.com
Blogger on raibledesigns.com
Web Developer and UI Architect
Montanan, Father, Husband, Skier,
Mountain Biker, Whitewater Rafter
Open Source Connoisseur
Who is Matt Raible?
Bus Lover
What about You?
How long have you been programming in Java?

Did you read Rod Johnson’s first book?

Did you ever use Struts?

What about Acegi Security?

What’s your most memorable development nightmare?
#NoXML
#NoXML: Eliminating XML in Spring Projects - SpringOne 2GX 2015
“Parallelize”
#NoXML: Eliminating XML in Spring Projects - SpringOne 2GX 2015
The JHipster Mini-Book
Written by yours truly

Quick and to the point

Less than 150 pages

Developing a Real World App

Free Download from
Java on the Desktop
Java on the Desktop
APIs on the JVM
“When web companies grow up they turn into Java shops” 

— James Governor

JAX London, October 29, 2013
Good Things in JavaLand
Big Data: Hadoop, Storm, Kafka, Cassandra and Apache Giraph

Groovy and Grails

Scala and Play

Spring Boot

Ratpack
Good Things in JavaLand
Big Data: Hadoop, Storm, Kafka, Cassandra and Apache Giraph

Groovy and Grails

Scala and Play

Spring Boot

Dropwizard
Spring Timeline
Spring Timeline
#NoXML: Eliminating XML in Spring Projects - SpringOne 2GX 2015
SPRING INITIALIZR @ start.spring.io
JHipster http://jhipster.github.io/
#NoXML: Eliminating XML in Spring Projects - SpringOne 2GX 2015
Spring Boot
Create stand-alone Spring applications

Embeds Tomcat, Jetty or Undertow directly 

Provides opinionated 'starter' POMs to simplify your Maven
configuration

Also supports/promotes using Gradle
Spring Boot
Automatically configures Spring whenever possible

Provides production-ready features such as metrics, health checks
and externalized configuration

Absolutely no code generation and no requirement for XML
configuration

Grails 3.0 is based on Spring Boot
Spring Boot
Automatically configures Spring whenever possible

Provides production-ready features such as metrics, health checks
and externalized configuration

Absolutely no code generation and no requirement for XML
configuration
Grails 3.0 is based on Spring Boot
JHipster
Spring Boot

Spring Security

AngularJS

Bootstrap

Bower

Metrics

Java 7 or Java 8

Maven or Gradle

Authentication Type: cookie-based
or OAuth2

Type of Database: SQL or NoSQL

Caching: EhCache or Hazelcast

Grunt or Gulp.js
Foundational Frameworks Project Options
Yeoman
The web's scaffolding tool for modern webapps

Helps you kickstart new projects

Promotes the Yeoman workflow
http://jhipster.github.io/ http://yeoman.io/
BrowserSync http://www.browsersync.io/
“Parallelize”
#NoXML
struts-config.xml
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
<form-beans>
<form-bean
name="templateForm"
type="org.appfuse.webapp.form.TemplateForm"
/>
<form-bean
name="resumeSkillForm"
type="org.appfuse.webapp.form.ResumeSkillForm"
/>
<form-bean
name="resumeForm"
type="org.appfuse.webapp.form.ResumeForm"
/>
<form-bean
name="roleForm"
type="org.appfuse.webapp.form.RoleForm"
/>
build.xml
<!DOCTYPE project [
<!ENTITY properties SYSTEM "file:./properties.xml">
<!ENTITY app-settings SYSTEM "file:./app-settings.xml">
]>
<project name="appfuse" basedir="." default="package-web">
<!-- import project-wide properties (classpath, jar file locations) -->
&properties;
<!-- import application settings for xdoclet -->
&app-settings;
<target name="define-tasks" description="defines custom tasks">
<!-- Taskdefs -->
<taskdef resource="net/sf/antcontrib/antcontrib.properties"
classpath="${ant-contrib.jar}"/>
<taskdef name="xdoclet"
classname="xdoclet.DocletTask"
classpathref="xdoclet.classpath"/>
<taskdef name="todo"
classname="xdoclet.modules.doc.DocumentDocletTask"
classpathref="xdoclet.classpath"/>
#NoXML: Eliminating XML in Spring Projects - SpringOne 2GX 2015
applicationContext.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd"
[<!ENTITY database SYSTEM "WEB-INF/applicationContext-database.xml">
<!ENTITY dao SYSTEM "WEB-INF/applicationContext-@DAO-TYPE@.xml">
<!ENTITY service SYSTEM "WEB-INF/applicationContext-service.xml">]>
<beans>
<!-- import database settings -->
&database;
<!-- import dao definitions -->
&dao;
<!-- import service definitions -->
&service;
</beans>
Acegi Security
applicationContext-security.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<!-- ======================== FILTER CHAIN ======================= -->
<bean id="filterChainProxy"
class="org.acegisecurity.util.FilterChainProxy">
<property name="filterInvocationDefinitionSource">
<value>
CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
PATTERN_TYPE_APACHE_ANT
/j_acegi_security_check*=httpSessionContextIntegrationFilter,authenticationProcessingFilter
/**/*=httpSessionContextIntegrationFilter,logoutFilter,authenticationProcessingFilter,
securityContextHolderAwareRequestFilter,anonymousProcessingFilter,
exceptionTranslationFilter,filterInvocationInterceptor
</value>
</property>
</bean>
#NoXML: Eliminating XML in Spring Projects - SpringOne 2GX 2015
mvn archetype:generate -B -DarchetypeGroupId=org.appfuse.archetypes 
-DarchetypeArtifactId=appfuse-basic-spring-archetype -DarchetypeVersion=3.5.0 
-DgroupId=com.raibledesigns -DartifactId=noxml 
-DarchetypeRepository=https://oss.sonatype.org/content/repositories/appfuse
#NoXML: Eliminating XML in Spring Projects - SpringOne 2GX 2015
#NoXML: Eliminating XML in Spring Projects - SpringOne 2GX 2015
#NoXML: Eliminating XML in Spring Projects - SpringOne 2GX 2015
AppFuse Features
Authentication and Security

User Management

Bootstrap and jQuery Integrated

REST API with CXF

Hibernate and JPA Support

CRUD Generation

Internationalization
JHipster Features
Authentication and Security

Spring Boot Metrics Dashboard

Bootstrap and AngularJS Integrated

REST API with Spring MVC

JPA Support and NoSQL Support

CRUD Generation

Internationalization
JHipster’s API Building Blocks
Spring Boot

Maven vs. Gradle

IDE Support: Running, Debugging and Profiling

Security

JPA vs. MongoDB vs. Cassandra

Liquibase

Elasticsearch

Spring WebSockets
Security
Spring Security 3.2.5

Remember Me

HttpSession Authentication

ZAP Tested
Improved Remember Me

Cookie theft protection

CSRF protection

Authentication

HTTP Session

Token-based 

OAuth2
JPA
Hibernate

Generic DAO

persistence.xml
Hibernate

Spring Data

Repositories

Dynamic Finders
Schema Generation and Population
Hibernate4 Plugin

DbUnit

Liquibase

CSV
Search
Hibernate Search Elasticsearch
@Indexed
@XmlRootElement
public class User extends BaseObject implements Serializable, UserDetails {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@DocumentId
public Long getId() {
return id;
}
@Column(nullable = false, length = 50, unique = true)
@Field
public String getUsername() {
return username;
}
Hibernate Search
@Indexed
@XmlRootElement
public class User extends BaseObject implements Serializable, UserDetails {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@DocumentId
public Long getId() {
return id;
}
@Column(nullable = false, length = 50, unique = true)
@Field
public String getUsername() {
return username;
}
Hibernate Search
Elasticsearch
@Entity
@Table(name = "JHI_USER")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@Document(indexName="user")
public class User extends AbstractAuditingEntity implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@NotNull
@Pattern(regexp = "^[a-z0-9]*$")
@Size(min = 1, max = 50)
@Column(length = 50, unique = true, nullable = false)
private String login;
Elasticsearch
@Entity
@Table(name = "JHI_USER")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@Document(indexName="user")
public class User extends AbstractAuditingEntity implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@NotNull
@Pattern(regexp = "^[a-z0-9]*$")
@Size(min = 1, max = 50)
@Column(length = 50, unique = true, nullable = false)
private String login;
WebSockets
None Spring WebSockets

Stomp

SockJS
WebSockets
@Configuration
@EnableWebSocketMessageBroker
public class WebsocketConfiguration extends AbstractWebSocketMessageBrokerConfigurer {
@Override
public void configureMessageBroker(MessageBrokerRegistry config) {
config.enableSimpleBroker("/topic");
}
@Override
public void registerStompEndpoints(StompEndpointRegistry registry) {
registry.addEndpoint("/websocket/tracker")
.setHandshakeHandler(new DefaultHandshakeHandler() {
//
})
.withSockJS()
.setInterceptors(httpSessionHandshakeInterceptor());
}
yo jhipster
#NoXML: Eliminating XML in Spring Projects - SpringOne 2GX 2015
#NoXML: Eliminating XML in Spring Projects - SpringOne 2GX 2015
#NoXML: Eliminating XML in Spring Projects - SpringOne 2GX 2015
#NoXML: Eliminating XML in Spring Projects - SpringOne 2GX 2015
Lines of Code Comparison
0
1000
2000
3000
4000
Java JavaScript XML HTML
AppFuse JHipster
#NoXML: Eliminating XML in Spring Projects - SpringOne 2GX 2015
XML to Feature Map
Build

Spring Config

DbUnit

EhCache

Hibernate

Log4J2

JPA

Validation

CXF

SiteMesh

Spring MVC

DWR

Struts Menu

Resin Web Config

Spring Security

UrlRewrite

Commons Validator

web.xml

Wro4j

Generated documentation

Integration Tests
How do we get rid of these?
Maven Gradle or Polyglot for Maven
Spring XML JavaConfig
DbUnit DataSetBuilder
EhCache @EnableCaching
Hibernate Spring Data
Log4J2 Configurator#initialize
Validation JSR 303
web.xml WebApplicationInitializer
Maven Site README.md
#NoXML: Eliminating XML in Spring Projects - SpringOne 2GX 2015
#NoXML: Eliminating XML in Spring Projects - SpringOne 2GX 2015
Live Demo
Recap
Spring XML to Java

Spring Security XML to Java

web.xml to WebApplicationInitializer

Spring MVC to Java

Migrated to Spring Boot
#NoXML: Eliminating XML in Spring Projects - SpringOne 2GX 2015
Discuss: How can things be even better?
Stay hip by following me!

http://raibledesigns.com

@mraible

Presentations

http://slideshare.net/mraible

Code

https://github.com/mraible/appfuse-noxml
Questions?

More Related Content

What's hot (20)

PPTX
Cache is King
Steve Souders
 
PDF
The DOM is a Mess @ Yahoo
jeresig
 
PDF
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx UK 2016
Matt Raible
 
PDF
Selenium RC: Automated Testing of Modern Web Applications
qooxdoo
 
PPT
High Performance Ajax Applications
Julien Lecomte
 
PDF
High Performance JavaScript 2011
Nicholas Zakas
 
PDF
Play vs Rails
Daniel Cukier
 
PPTX
Intro to Pentesting Jenkins
Brian Hysell
 
PDF
Dust.js
Yevgeniy Brikman
 
PPT
Java 6 [Mustang] - Features and Enchantments
Pavel Kaminsky
 
PDF
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx France 2016
Matt Raible
 
PPTX
Pentesting Modern Web Apps: A Primer
Brian Hysell
 
PDF
Avoiding Common Pitfalls in Ember.js
Alex Speller
 
PDF
Webpack packing it all
Criciúma Dev
 
KEY
Mobile HTML, CSS, and JavaScript
franksvalli
 
PDF
Cross-browser testing in the real world
Martin Kleppmann
 
PDF
Getting Started with Angular - Stormpath Webinar, January 2017
Matt Raible
 
PPTX
Enough with the JavaScript already!
Nicholas Zakas
 
PDF
Design patterns revisited with PHP 5.3
Fabien Potencier
 
PDF
High Performance JavaScript - WebDirections USA 2010
Nicholas Zakas
 
Cache is King
Steve Souders
 
The DOM is a Mess @ Yahoo
jeresig
 
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx UK 2016
Matt Raible
 
Selenium RC: Automated Testing of Modern Web Applications
qooxdoo
 
High Performance Ajax Applications
Julien Lecomte
 
High Performance JavaScript 2011
Nicholas Zakas
 
Play vs Rails
Daniel Cukier
 
Intro to Pentesting Jenkins
Brian Hysell
 
Java 6 [Mustang] - Features and Enchantments
Pavel Kaminsky
 
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx France 2016
Matt Raible
 
Pentesting Modern Web Apps: A Primer
Brian Hysell
 
Avoiding Common Pitfalls in Ember.js
Alex Speller
 
Webpack packing it all
Criciúma Dev
 
Mobile HTML, CSS, and JavaScript
franksvalli
 
Cross-browser testing in the real world
Martin Kleppmann
 
Getting Started with Angular - Stormpath Webinar, January 2017
Matt Raible
 
Enough with the JavaScript already!
Nicholas Zakas
 
Design patterns revisited with PHP 5.3
Fabien Potencier
 
High Performance JavaScript - WebDirections USA 2010
Nicholas Zakas
 

Viewers also liked (20)

PPTX
Electronic governance steps in the right direction?
Bozhidar Bozhanov
 
PDF
The Art of AngularJS in 2015 - Angular Summit 2015
Matt Raible
 
PDF
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Angular Summit 2015
Matt Raible
 
PDF
Get Hip with JHipster - Denver JUG 2015
Matt Raible
 
PDF
Developing, Testing and Scaling with Apache Camel - UberConf 2015
Matt Raible
 
PDF
Java Web Application Security with Java EE, Spring Security and Apache Shiro ...
Matt Raible
 
PDF
The Modern Java Web Developer - JavaOne 2013
Matt Raible
 
PDF
The Modern Java Web Developer Bootcamp - Devoxx 2013
Matt Raible
 
PDF
The Art of Angular in 2016 - Devoxx UK 2016
Matt Raible
 
PDF
The Art of Angular in 2016 - Devoxx France 2016
Matt Raible
 
PDF
Comparing JVM Web Frameworks - Devoxx France 2013
Matt Raible
 
PDF
Java Web Application Security - Denver JUG 2013
Matt Raible
 
PDF
Comparing JVM Web Frameworks - February 2014
Matt Raible
 
PPTX
Spring Framework Petclinic sample application
Antoine Rey
 
PDF
The Modern Java Web Developer - Denver JUG 2013
Matt Raible
 
PPTX
Introduction à spring boot
Antoine Rey
 
PDF
Introduction to Hardware with littleBits
Tack Mobile
 
PDF
Java Web Application Security - Utah JUG 2011
Matt Raible
 
PDF
Just enough app server
Antonio Goncalves
 
PDF
The Art of AngularJS - DeRailed 2014
Matt Raible
 
Electronic governance steps in the right direction?
Bozhidar Bozhanov
 
The Art of AngularJS in 2015 - Angular Summit 2015
Matt Raible
 
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Angular Summit 2015
Matt Raible
 
Get Hip with JHipster - Denver JUG 2015
Matt Raible
 
Developing, Testing and Scaling with Apache Camel - UberConf 2015
Matt Raible
 
Java Web Application Security with Java EE, Spring Security and Apache Shiro ...
Matt Raible
 
The Modern Java Web Developer - JavaOne 2013
Matt Raible
 
The Modern Java Web Developer Bootcamp - Devoxx 2013
Matt Raible
 
The Art of Angular in 2016 - Devoxx UK 2016
Matt Raible
 
The Art of Angular in 2016 - Devoxx France 2016
Matt Raible
 
Comparing JVM Web Frameworks - Devoxx France 2013
Matt Raible
 
Java Web Application Security - Denver JUG 2013
Matt Raible
 
Comparing JVM Web Frameworks - February 2014
Matt Raible
 
Spring Framework Petclinic sample application
Antoine Rey
 
The Modern Java Web Developer - Denver JUG 2013
Matt Raible
 
Introduction à spring boot
Antoine Rey
 
Introduction to Hardware with littleBits
Tack Mobile
 
Java Web Application Security - Utah JUG 2011
Matt Raible
 
Just enough app server
Antonio Goncalves
 
The Art of AngularJS - DeRailed 2014
Matt Raible
 
Ad

Similar to #NoXML: Eliminating XML in Spring Projects - SpringOne 2GX 2015 (20)

PDF
What's New in Spring 3.1
Matt Raible
 
KEY
A Walking Tour of (almost) all of Springdom
Joshua Long
 
PDF
Advance Java Training in Bangalore | Best Java Training Institute
TIB Academy
 
PDF
Spring 3 - An Introduction
Thorsten Kamann
 
PDF
The spring 32 update final
Joshua Long
 
PPT
Spring, web service, web server, eclipse by a introduction sandesh sharma
Sandesh Sharma
 
PPTX
Spring MVC 5 & Hibernate 5 Integration
Majurageerthan Arumugathasan
 
PPT
Spring 3.1: a Walking Tour
Joshua Long
 
PDF
Toms introtospring mvc
Guo Albert
 
PDF
PUC SE Day 2019 - SpringBoot
Josué Neis
 
KEY
Enterprise Java Web Application Frameworks Sample Stack Implementation
Mert Çalışkan
 
PPTX
Spring framework
Rajkumar Singh
 
DOCX
Spring interview questions
SkillPracticalEdTech
 
PPT
Spring Boot in Action
Alex Movila
 
PPT
Hybernat and structs, spring classes in mumbai
Vibrant Technologies & Computers
 
PDF
The Spring Update
Gunnar Hillert
 
PDF
Spark IT 2011 - Java EE 6 Workshop
Arun Gupta
 
PPTX
Building enterprise web applications with spring 3
Abdelmonaim Remani
 
DOCX
Spring diy projects
SkillPracticalEdTech
 
PPTX
Spring Basics
Emprovise
 
What's New in Spring 3.1
Matt Raible
 
A Walking Tour of (almost) all of Springdom
Joshua Long
 
Advance Java Training in Bangalore | Best Java Training Institute
TIB Academy
 
Spring 3 - An Introduction
Thorsten Kamann
 
The spring 32 update final
Joshua Long
 
Spring, web service, web server, eclipse by a introduction sandesh sharma
Sandesh Sharma
 
Spring MVC 5 & Hibernate 5 Integration
Majurageerthan Arumugathasan
 
Spring 3.1: a Walking Tour
Joshua Long
 
Toms introtospring mvc
Guo Albert
 
PUC SE Day 2019 - SpringBoot
Josué Neis
 
Enterprise Java Web Application Frameworks Sample Stack Implementation
Mert Çalışkan
 
Spring framework
Rajkumar Singh
 
Spring interview questions
SkillPracticalEdTech
 
Spring Boot in Action
Alex Movila
 
Hybernat and structs, spring classes in mumbai
Vibrant Technologies & Computers
 
The Spring Update
Gunnar Hillert
 
Spark IT 2011 - Java EE 6 Workshop
Arun Gupta
 
Building enterprise web applications with spring 3
Abdelmonaim Remani
 
Spring diy projects
SkillPracticalEdTech
 
Spring Basics
Emprovise
 
Ad

More from Matt Raible (20)

PDF
Keep Identities in Sync the SCIMple Way - ApacheCon NA 2022
Matt Raible
 
PDF
Micro Frontends for Java Microservices - Belfast JUG 2022
Matt Raible
 
PDF
Micro Frontends for Java Microservices - Dublin JUG 2022
Matt Raible
 
PDF
Micro Frontends for Java Microservices - Cork JUG 2022
Matt Raible
 
PDF
Comparing Native Java REST API Frameworks - Seattle JUG 2022
Matt Raible
 
PDF
Reactive Java Microservices with Spring Boot and JHipster - Spring I/O 2022
Matt Raible
 
PDF
Comparing Native Java REST API Frameworks - Devoxx France 2022
Matt Raible
 
PDF
Lock That Sh*t Down! Auth Security Patterns for Apps, APIs, and Infra - Devne...
Matt Raible
 
PDF
Native Java with Spring Boot and JHipster - Garden State JUG 2021
Matt Raible
 
PDF
Java REST API Framework Comparison - PWX 2021
Matt Raible
 
PDF
Web App Security for Java Developers - PWX 2021
Matt Raible
 
PDF
Mobile App Development with Ionic, React Native, and JHipster - Connect.Tech ...
Matt Raible
 
PDF
Lock That Shit Down! Auth Security Patterns for Apps, APIs, and Infra - Joker...
Matt Raible
 
PDF
Web App Security for Java Developers - UberConf 2021
Matt Raible
 
PDF
Java REST API Framework Comparison - UberConf 2021
Matt Raible
 
PDF
Native Java with Spring Boot and JHipster - SF JUG 2021
Matt Raible
 
PDF
Lock That Shit Down! Auth Security Patterns for Apps, APIs, and Infra - Sprin...
Matt Raible
 
PDF
Reactive Java Microservices with Spring Boot and JHipster - Denver JUG 2021
Matt Raible
 
PDF
Get Hip with JHipster - Colorado Springs Open Source User Group 2021
Matt Raible
 
PDF
JHipster and Okta - JHipster Virtual Meetup December 2020
Matt Raible
 
Keep Identities in Sync the SCIMple Way - ApacheCon NA 2022
Matt Raible
 
Micro Frontends for Java Microservices - Belfast JUG 2022
Matt Raible
 
Micro Frontends for Java Microservices - Dublin JUG 2022
Matt Raible
 
Micro Frontends for Java Microservices - Cork JUG 2022
Matt Raible
 
Comparing Native Java REST API Frameworks - Seattle JUG 2022
Matt Raible
 
Reactive Java Microservices with Spring Boot and JHipster - Spring I/O 2022
Matt Raible
 
Comparing Native Java REST API Frameworks - Devoxx France 2022
Matt Raible
 
Lock That Sh*t Down! Auth Security Patterns for Apps, APIs, and Infra - Devne...
Matt Raible
 
Native Java with Spring Boot and JHipster - Garden State JUG 2021
Matt Raible
 
Java REST API Framework Comparison - PWX 2021
Matt Raible
 
Web App Security for Java Developers - PWX 2021
Matt Raible
 
Mobile App Development with Ionic, React Native, and JHipster - Connect.Tech ...
Matt Raible
 
Lock That Shit Down! Auth Security Patterns for Apps, APIs, and Infra - Joker...
Matt Raible
 
Web App Security for Java Developers - UberConf 2021
Matt Raible
 
Java REST API Framework Comparison - UberConf 2021
Matt Raible
 
Native Java with Spring Boot and JHipster - SF JUG 2021
Matt Raible
 
Lock That Shit Down! Auth Security Patterns for Apps, APIs, and Infra - Sprin...
Matt Raible
 
Reactive Java Microservices with Spring Boot and JHipster - Denver JUG 2021
Matt Raible
 
Get Hip with JHipster - Colorado Springs Open Source User Group 2021
Matt Raible
 
JHipster and Okta - JHipster Virtual Meetup December 2020
Matt Raible
 

Recently uploaded (20)

PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PDF
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 

#NoXML: Eliminating XML in Spring Projects - SpringOne 2GX 2015

  • 1. Photos by #NoXML: Eliminating XML in Spring Projects Matt Raible • http://raibledesigns.com
  • 2. Blogger on raibledesigns.com Web Developer and UI Architect Montanan, Father, Husband, Skier, Mountain Biker, Whitewater Rafter Open Source Connoisseur Who is Matt Raible? Bus Lover
  • 3. What about You? How long have you been programming in Java? Did you read Rod Johnson’s first book? Did you ever use Struts? What about Acegi Security? What’s your most memorable development nightmare?
  • 8. The JHipster Mini-Book Written by yours truly Quick and to the point Less than 150 pages Developing a Real World App Free Download from
  • 9. Java on the Desktop
  • 10. Java on the Desktop
  • 11. APIs on the JVM “When web companies grow up they turn into Java shops” — James Governor
 JAX London, October 29, 2013
  • 12. Good Things in JavaLand Big Data: Hadoop, Storm, Kafka, Cassandra and Apache Giraph Groovy and Grails Scala and Play Spring Boot Ratpack
  • 13. Good Things in JavaLand Big Data: Hadoop, Storm, Kafka, Cassandra and Apache Giraph Groovy and Grails Scala and Play Spring Boot Dropwizard
  • 17. SPRING INITIALIZR @ start.spring.io
  • 20. Spring Boot Create stand-alone Spring applications Embeds Tomcat, Jetty or Undertow directly Provides opinionated 'starter' POMs to simplify your Maven configuration Also supports/promotes using Gradle
  • 21. Spring Boot Automatically configures Spring whenever possible Provides production-ready features such as metrics, health checks and externalized configuration Absolutely no code generation and no requirement for XML configuration Grails 3.0 is based on Spring Boot
  • 22. Spring Boot Automatically configures Spring whenever possible Provides production-ready features such as metrics, health checks and externalized configuration Absolutely no code generation and no requirement for XML configuration Grails 3.0 is based on Spring Boot
  • 23. JHipster Spring Boot Spring Security AngularJS Bootstrap Bower Metrics Java 7 or Java 8 Maven or Gradle Authentication Type: cookie-based or OAuth2 Type of Database: SQL or NoSQL Caching: EhCache or Hazelcast Grunt or Gulp.js Foundational Frameworks Project Options
  • 24. Yeoman The web's scaffolding tool for modern webapps Helps you kickstart new projects Promotes the Yeoman workflow http://jhipster.github.io/ http://yeoman.io/
  • 28. struts-config.xml <?xml version="1.0" encoding="ISO-8859-1" ?> <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd"> <struts-config> <form-beans> <form-bean name="templateForm" type="org.appfuse.webapp.form.TemplateForm" /> <form-bean name="resumeSkillForm" type="org.appfuse.webapp.form.ResumeSkillForm" /> <form-bean name="resumeForm" type="org.appfuse.webapp.form.ResumeForm" /> <form-bean name="roleForm" type="org.appfuse.webapp.form.RoleForm" />
  • 29. build.xml <!DOCTYPE project [ <!ENTITY properties SYSTEM "file:./properties.xml"> <!ENTITY app-settings SYSTEM "file:./app-settings.xml"> ]> <project name="appfuse" basedir="." default="package-web"> <!-- import project-wide properties (classpath, jar file locations) --> &properties; <!-- import application settings for xdoclet --> &app-settings; <target name="define-tasks" description="defines custom tasks"> <!-- Taskdefs --> <taskdef resource="net/sf/antcontrib/antcontrib.properties" classpath="${ant-contrib.jar}"/> <taskdef name="xdoclet" classname="xdoclet.DocletTask" classpathref="xdoclet.classpath"/> <taskdef name="todo" classname="xdoclet.modules.doc.DocumentDocletTask" classpathref="xdoclet.classpath"/>
  • 31. applicationContext.xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd" [<!ENTITY database SYSTEM "WEB-INF/applicationContext-database.xml"> <!ENTITY dao SYSTEM "WEB-INF/applicationContext-@[email protected]"> <!ENTITY service SYSTEM "WEB-INF/applicationContext-service.xml">]> <beans> <!-- import database settings --> &database; <!-- import dao definitions --> &dao; <!-- import service definitions --> &service; </beans>
  • 33. applicationContext-security.xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans> <!-- ======================== FILTER CHAIN ======================= --> <bean id="filterChainProxy" class="org.acegisecurity.util.FilterChainProxy"> <property name="filterInvocationDefinitionSource"> <value> CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON PATTERN_TYPE_APACHE_ANT /j_acegi_security_check*=httpSessionContextIntegrationFilter,authenticationProcessingFilter /**/*=httpSessionContextIntegrationFilter,logoutFilter,authenticationProcessingFilter, securityContextHolderAwareRequestFilter,anonymousProcessingFilter, exceptionTranslationFilter,filterInvocationInterceptor </value> </property> </bean>
  • 35. mvn archetype:generate -B -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-basic-spring-archetype -DarchetypeVersion=3.5.0 -DgroupId=com.raibledesigns -DartifactId=noxml -DarchetypeRepository=https://oss.sonatype.org/content/repositories/appfuse
  • 39. AppFuse Features Authentication and Security User Management Bootstrap and jQuery Integrated REST API with CXF Hibernate and JPA Support CRUD Generation Internationalization
  • 40. JHipster Features Authentication and Security Spring Boot Metrics Dashboard Bootstrap and AngularJS Integrated REST API with Spring MVC JPA Support and NoSQL Support CRUD Generation Internationalization
  • 41. JHipster’s API Building Blocks Spring Boot Maven vs. Gradle IDE Support: Running, Debugging and Profiling Security JPA vs. MongoDB vs. Cassandra Liquibase Elasticsearch Spring WebSockets
  • 42. Security Spring Security 3.2.5 Remember Me HttpSession Authentication ZAP Tested Improved Remember Me Cookie theft protection CSRF protection Authentication HTTP Session Token-based OAuth2
  • 44. Schema Generation and Population Hibernate4 Plugin DbUnit Liquibase CSV
  • 46. @Indexed @XmlRootElement public class User extends BaseObject implements Serializable, UserDetails { @Id @GeneratedValue(strategy = GenerationType.AUTO) @DocumentId public Long getId() { return id; } @Column(nullable = false, length = 50, unique = true) @Field public String getUsername() { return username; } Hibernate Search
  • 47. @Indexed @XmlRootElement public class User extends BaseObject implements Serializable, UserDetails { @Id @GeneratedValue(strategy = GenerationType.AUTO) @DocumentId public Long getId() { return id; } @Column(nullable = false, length = 50, unique = true) @Field public String getUsername() { return username; } Hibernate Search
  • 48. Elasticsearch @Entity @Table(name = "JHI_USER") @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) @Document(indexName="user") public class User extends AbstractAuditingEntity implements Serializable { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; @NotNull @Pattern(regexp = "^[a-z0-9]*$") @Size(min = 1, max = 50) @Column(length = 50, unique = true, nullable = false) private String login;
  • 49. Elasticsearch @Entity @Table(name = "JHI_USER") @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) @Document(indexName="user") public class User extends AbstractAuditingEntity implements Serializable { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; @NotNull @Pattern(regexp = "^[a-z0-9]*$") @Size(min = 1, max = 50) @Column(length = 50, unique = true, nullable = false) private String login;
  • 51. WebSockets @Configuration @EnableWebSocketMessageBroker public class WebsocketConfiguration extends AbstractWebSocketMessageBrokerConfigurer { @Override public void configureMessageBroker(MessageBrokerRegistry config) { config.enableSimpleBroker("/topic"); } @Override public void registerStompEndpoints(StompEndpointRegistry registry) { registry.addEndpoint("/websocket/tracker") .setHandshakeHandler(new DefaultHandshakeHandler() { // }) .withSockJS() .setInterceptors(httpSessionHandshakeInterceptor()); }
  • 57. Lines of Code Comparison 0 1000 2000 3000 4000 Java JavaScript XML HTML AppFuse JHipster
  • 59. XML to Feature Map Build Spring Config DbUnit EhCache Hibernate Log4J2 JPA Validation CXF SiteMesh Spring MVC DWR Struts Menu Resin Web Config Spring Security UrlRewrite Commons Validator web.xml Wro4j Generated documentation Integration Tests
  • 60. How do we get rid of these? Maven Gradle or Polyglot for Maven Spring XML JavaConfig DbUnit DataSetBuilder EhCache @EnableCaching Hibernate Spring Data Log4J2 Configurator#initialize Validation JSR 303 web.xml WebApplicationInitializer Maven Site README.md
  • 64. Recap Spring XML to Java Spring Security XML to Java web.xml to WebApplicationInitializer Spring MVC to Java Migrated to Spring Boot
  • 66. Discuss: How can things be even better?
  • 67. Stay hip by following me! http://raibledesigns.com @mraible Presentations http://slideshare.net/mraible Code https://github.com/mraible/appfuse-noxml Questions?