Matt RaibleMatt Raible is a Java Champion and Developer Advocate at Okta. developer.okta.com

The JHipster Mini-Book The JHipster Mini-Book is a guide to getting started with hip technologies today: AngularJS, Bootstrap, and Spring Boot. All of these frameworks are wrapped up in an easy-to-use project called JHipster.

This book shows you how to build an app with JHipster, and guides you through the plethora of tools, techniques and options you can use. Furthermore, it explains the UI and API building blocks so you understand the underpinnings of your great application.

For book updates, follow @jhipster-book on Twitter.

10+ YEARS


Over 10 years ago, I wrote my first blog post. Since then, I've authored books, had kids, traveled the world, found Trish and blogged about it all.

[TSE] Keynote: The Bigger Picture with Adrian Colyer

We've seen a lot of things over the last few days, but what about the big picture? It's not just about the Spring Framework anymore, but there's also a lot of sub-projects: SFW, SWF, SWS, S-OSGi. Then there's Enterprise services: clustering, persistence, messaging and scheduling. Industry trends: SOA, Web 2.0/RIA, RAD stacks.

Agenda

  • Spring portfolio: unifying themes, fitting the pieces together (by layer) and future direction
  • Facing the feature: my boss says I need a SOA, from auto-suggest to RIA and the quest for ever-increasing productivity

The first thing that's Spring has done is to give you a triangular simple object. Because a triangle is one of the strongest shapes, this is why Spring holds up to heavy loads and lots of users. Triangles work much better than circles.

Spring is built on "simple objects" and 3 principles: Dependency Injection, AOP and Portable Service Abstractions.

The "blueprints" that Spring provides are a great way to understand applications. If a a team uses simple objects + blueprints, chances are an experienced Spring developer can understand how most of the application works.

Data Access Layer
Spring supports JDBC, iBATIS, JDO, Hibernate, TopLink. In addition, Spring 2.0 has JPA Support, including OpenJPA, TopLink Essentials and Hibernate. Further enhancements coming for 2.1: JPA namespace and support for common non-standard features (for example, criteria API and user types).

Other backends: Spring also has support for accessing enterprise systems, CICS and IMS. Spring has JCA CCI support with the CCiTemplate.

Spring LDAP project adds support for interacting with LDAP servers. I've worked with Spring LDAP and it certainly does work nice. The only thing I found painful was that it didn't support transactions, but neither does LDAP, so that's to be expected. If you've never used Spring LDAP, you probably already know a lot about LdapTemplate, even if you haven't used it.

Service Layer
You all know how to define business services, but what about scheduling, asynchronous messaging, ESBs, etc? Spring has support for scheduling with JDK Timer and Quartz. You can run jobs in background with cron expressions or simple triggers. MethodInvokingJobDetailFactoryBean makes it trivial to execute an operation on a bean.

Asynchronous tasks can be run by TaskExecutor. It can be kicked off programmatically or by a scheduler. Simple confugiration change to switch from thread pool to commonj work manager.

Messaging: Spring 2.0 extended Spring's JMS support. JmsTemplate + Message-driven POJOs. It's fully Java EE compliant, can participate in a transaction and process a message and send a reply in one unit of work.

For XML payloads, you can use Spring Web Services to do OXM (Object XML Mapping).

Is all this heading towards an ESB-like system? In a sense, so why not just use a full-blown ESB like Mule. Mule 2.0 is being re-written to be entirely based on Spring.

ESB - Mule integration: Spring application context support simple event framework: ApplicationEventPublisher and ApplicationEventPublisherAware, ApplicationEvent and ApplicationListener. Simple for a bean to publish and listen to events. Mule can integrate into this as a custom event multi-caster.

Configure a bean to listen only to events of interest using MuleSubscriptionEventListener. You can publish events to mule using a normal ApplicationEventPublisher interface and create a MuleApplicationEvent to publish.

Clustering

  • Tangosol Coherence and Coherence Data Grid for Spring: You can use a <datagrid:member> to register application context as a member of a DataGrid. Application events are grid-wide. <bean id="..." scope="datagrid">: bean operations "in-place" in the grid. There's no need for cluster-wide locking (b/c it's fast). DataGridBean transaction management. <datagrid:cache/> allows you to define a datagrid as a bean. Furthermore, there's Java and .NET interoparability for DataGrid beans.
  • GigaSpaces 5.2 was announced last week. Use POJOs as space entries, full Spring transaction integration. There's also a PlatformTransactionManager implementation. You can access their DataGrid using a JdbcTemplate and GigaSpaces' JDBC Driver, or you can use the GigaSpacesTemplate. You can access the GigaSpaces MessageGrid via Spring's JMS abstraction. You can submit jobs to the ComputeGrid, which is a parallel processing engine. It works with Spring AOP to create proxy to remove service and uses a DelegratingWorker from Spring modules for task execution.
  • Terracotta: Allows you to cluster any singleton Spring bean. Beans named in Terracotta configuration file, and clustering is completely transparent to Spring and to your application. The state of that bean will be shared across the cluster. You can publish ApplicationEvents across the cluster - where application events are propogated to all listers in each JVM. Terracotta allows clustering Spring Web Flow to enable failover of conversation state. AOP + clustered beans + Spring JMX = cluster management view (view local vs. clustered data). Now free and open source!

Security impacts all layers. It starts in remote and web interfaces and can be useful for role-based method-invocations in service layer and data layer. Furthermore, Acegi's ACLs can be very useful for fine-grained security on domain objects. "Spring Security is one of the hidden jewels in the bunch here."

Presentation Layer
Spring Rich Client is another member of the Spring family that allows you to leverage Spring ideas in a Swing application. Has support for GUI builders and many other features that allow you to write Swing easier.

Spring MVC is great for free navigation and has a nice Controller hierarchy. Supports many more view options than just JSP. When developing wizards, it gets a bit more complicated. If you're stressing AbstractWizardFormController even a little bit, it's time for Spring Web Flow.

Spring Web Flow is for controlled navigation. You can model a web interaction as a flow and declare states and transitions between them. By modeling that flow in a blueprint and declaring the various states and transitions, you can easily abstract and compose how to navigate between pages. SWF can be used with servlets, portlets and multiple web frameworks. It supports post-redirect-get automatically and browser buttons "just work".

Where is future for SWF: even simpler flow definitions for common patterns (higher level of abstraction in configuration. Also, first class JSF support. Apparently, the JSF support is not as good as they'd like it to be.

Spring IDE has support for code-completion in XML, the "p" namespace and composing web flows graphically. Spring IDE also will have AOP support, much like AJT gives you for AspectJ (this is very cool IMO). With the AOP support, you can navigate between an Aspect and the XML configuration that defines it.

Web 2.0 / Ajax / RIA - what about creating the better using experience with these tools? Ajax ingredients are UI toolkits, effects and a means of communicating with the server. To return XML from Spring MVC, you can use AbstractXsltView (with no styleSheetLocation set). For converting model objects to XML, you can use Spring Web Services OXM stuff. It can get simpler than that - just use DWR and JSON-RPC. If you want to secure DWR, Spring Security will allow you to do that. Acegi is apparently looking at doing better support for Ajax and DWR. DWR 2.0 has a new Spring <dwr:*> namespace that allows you to easily nest a <dwr:remote> tag in a bean definition and expose that bean as a JavaScript object.

If you need a real web service, Spring supports that. Use XFireExporter for simple RPC style services. For everything else, there's Spring Web Services. It has an Object/XML mapping abstraction, a framework that resembles Spring MVC and it supports WS-Security with Spring Security. Interface21 has heard from many customers that Spring WS is one of their favorite pieces of the Spring portfolio.

OSOA (Open SOA Collaboration) is made up of a number of companies: BEA, IBM, Oracle, SAP, Sun ... and ... Interface21.

Service Component Architecture - course grained SOA. It has an assembly model with service components, references and wires everything together. It also contains a policy framework that supports QoS. Service implementation and client API can be Java, C++, BPEL, EJB or Spring.

AOP
Spring 2.0 delivered close integration between AspectJ and Spring AOP. It's also easy to use the full power of AspectJ with Spring application if you need it. AOP + JMX is particularly compelling - take a look at the Glassbox project for an example of this. Juergen has also been working on integrating load-time weaving as your application context is being initialized.

Spring-OSGi - allows you to use a SOA across application context within the same application. Allows a very strong module system, versioning, concurrent deployment (of different versions) and hot re-deploy.

Rapid Application Development: Spring 2.0 supports beans written in alternative languages: JRuby, Groovy and Beanshell. ROO (Real Object Oriented) application. Domain first, infrastructure second. Full static rapid development and has been validated with clients to great success.

Summary
Spring has consistent themes and approach. More than just "The Spring Framework". There's over 20 projects in addition to core Spring that allow you to do great things and build applications easier. Eight of these projects are lead by Interface21. Next year, they're hoping to do something like Callisto where all Spring-related projects can do a simultaneous release.

My Thoughts
Interestingly enough, many of the web frameworks that build on Spring aren't listed here (AppFuse, Grails, Trails, etc.). That makes sense since these projects are most useful when doing greenfield development and I doubt Interface21 does much of that.

With all of the Spring projects, Interface21 is starting to look like JBoss. However, one of the major differences between I21 and JBoss is the majority of Spring projects are actually not lead by Interface21.

This was one of my favorite talks of the show because it talked about the future of Spring and what's on the roadmap for many sub-projects.

Posted in Java at Dec 09 2006, 07:26:49 PM MST 3 Comments
Comments:

For the record. Terracotta can cluster not only singleton beans. Any non prototype beans can be clustered (singletons, session-scoped and even custom-scoped). Actually even prototype beans can be clustered if you inject them into other clustered beans.

Also note that Spring WebFlow clustering is build on http session clustering, which allows to store really big objects and efficiently mutate them between requests.

Posted by Eugene Kuleshov on December 10, 2006 at 11:34 AM MST #

Great write up! Just additional note re-GigaSpaces-Spring integration. GigaSpaces supports also the Cache module for declarative caching services.

The code itself is part of the SpringModule Cache plugin see:

https://springmodules.dev.java.net/source/browse/springmodules/projects/cache/src/java/org/springmodules/cache/provider/gigaspaces/

And

https://springmodules.dev.java.net/docs/reference/0.7/html_single/#cache

Also, GigaSpaces has a vary solid Java, C++ and .NET interoperability with all its DataGrid, Messaging and Parallel processing components.

Cheers
Gershon
Write Once. Scale Anywhere.
Web: www.gigaspaces.com
Blog: www.gigaspacesblog.com

Posted by Gershon Diner on December 11, 2006 at 12:15 AM MST #

[Trackback] ??? ??? ??? ?? ??? ??? ??? ?????.(??? ? ???..??;)Data Access Layer??? JDBC, iBATIS, JDO, Hibernate, TopLink ??? ???2.0??? JPA ??(OpenJPA, TopLink Essentials and Hibernate)2.1: JPA namespace and support for common non-standard features (for example, cri...

Posted by Younghoe.Info on December 11, 2006 at 08:28 AM MST #

Post a Comment:
  • HTML Syntax: Allowed