Spring+JBoss, So Happy Together!

tenchraceΛογισμικό & κατασκευή λογ/κού

14 Ιουλ 2012 (πριν από 6 χρόνια και 9 μέρες)

1.071 εμφανίσεις

Spring+JBoss, So Happy Together!
Reza Rahman
with special thanks to Marius Bogoevici of JBoss
Independent Consultant
Expert Group Member, Java EE 6
Resin EJB 3.1 Lite Container Developer
June, 2010
Spring 3

Large majority of Java EE 6 APIs can be used
effectively with Spring 3

Java EE 6 support major theme of Spring 3 including
bean validation, JSF 2, JPA 2, managed beans, JSR 330
and even more EJB 3 annotations

Spring supports many JBoss APIs such as Hibernate,
Drools, jBPM and JBossCache

Create powerful hybrid solutions to get the best of both

Even better interoperability in the future via Seam 3
JBoss Enterprise Application Platform

JBoss EAP (Enterprise Application Platform) is the Java
EE platform from JBoss

JBoss AS is the underlying community project

JBoss is one of the leading open source application
servers and is a popular runtime for Spring

JBoss EAP includes Seam, Hibernate, RESTEasy, EJB
3, JTA, messaging, pooling, caching, clustering,
debugging, JMX, monitoring, management

Integrated standards-based platform that minimizes
needless configuration and allows focus on business
Spring + JBoss
Spring + JSF

JSF widely used in the Spring community, likely to
increase adoption with JSF 2 and Facelets

RichFaces for Ajax powered JSF components

JSFUnit for robust JSF testing

Spring beans can be injected into JSF Managed Beans

Spring beans can be referenced in EL with no JSF
Backing Beans
Spring + JSF Demo!
Spring + Hibernate Validator

Allows validation constraints to be declared only once
and used across application

Hibernate Validator standardized as Bean Validation
(JSR 303)

Usually used through JSF 2 and JPA 2 without any
Spring configuration

Spring can be used to inject Validator and use Bean
Validation with Spring MVC instead of JSF 2
Spring + JSF + JPA + Bean Validation Demo!
Spring + Hibernate

Hibernate is popular with the Spring community, JPA
usage is growing steadily

Hibernate to implement JPA 2

Spring can use JPA or Hibernate natively

JPA needs less configuration and is more streamlined

JBossJTA uses local transactions by default and
transparently upgrades to XA when actually needed

JBoss data sources can use pooling, prepared
statement caching, debugging, monitoring and security
Spring + Hibernate Demo!
Spring + RESTEasy

RESTEasy is an excellent implementation of JAX-RS

Spring has Spring MVC based non-standard REST API

JAX-RS has better adoption in the Spring community

RESTEasy includes integration support for Spring

JAX-RS via EJB 3/Spring integration minimizes
needless configuration
Spring + RESTEasy Demo!
Spring + HornetQ

HornetQ very capable JMS platform included in JBoss

HornetQ is the SPECjms2007 record breaker

Spring JmsTemplate can be used on top of raw JMS
API for ease-of-use (with some careful considerations)

Spring listeners equivalent to EJB 3 Message Driven
Beans, especially JCA rather than JMS listeners

Transactions, acknowledgement, pooling, parallel
processing not provided by default!

EJB 3 can be used for better reliability and scalability
Spring + HornetQ Demo!
Spring + EJB 3

EJB 3 beans transactional, secure, pooled, thread-safe,
bandwidth-throttled and closely managed by server

EJB 3 can utilize passivation, caching, clustering, load-
balancing and remoting

EJB 3 is well-equipped for the service tier of non-trivial
applications but is overkill for most other components

Streamlined EJB 3 component model approaches zero-
configuration systems with intelligent defaults

Spring 3 supports excellent bi-directional integration
with EJB 3, as does JBoss Spring Deployer
Spring + EJB 3 Demo!
Other JBoss Technologies with Spring


Integration through EJB 3 or Spring JAX-WS exporter


Rules engine support through Spring modules


jBPM support through Spring modules


Caching support through Spring modules


JBoss ESB has excellent built-in integration with Spring
Spring on Tomcat with JBoss Technologies

JSF, Hibernate Validator, JPA/Hibernate, RESTEasy
and HornetQ can easily be embedded into Tomcat, as
can most JBoss technologies like CDI/Weld/Seam

Generally requires additional configuration either via
Spring and/or Servlet

Spring provides specialized configuration for more
complex integration cases like JPA/Hibernate and
surrogate services for transactions, database
connectivity, etc

Embedded JBoss can even be integrated into Tomcat
to provide EJB 3, JAX-WS, JTA, database pooling, JMX,

Create a powerful super-stack that utilizes the strengths
of both Spring and Java EE/JBoss technologies

Use JBoss as the runtime API for standardization,
usability, administration and scalability while Spring is
used for flexibility and third-party integration as well as
preserving existing development investment

Can also use Java EE/JBoss technologies on Tomcat
with Spring

Seam 3 allows for even better Spring integration to
utilize CDI features and portable modular extensions

Spring 3 Reference:

Spring Modules:

JBoss Snowdrop:

JBoss RESTEasy:


Seam 3: