Você está na página 1de 29

A Tour through Spring 3

Keith Donald, Principal Engineer

CONFIDENTIAL

© 2010 SpringSource, A division of VMware. All rights reserved


Topics
 MVC
 Ajax
 Web Flow
 Security
 Integration
 Flex
 Tools and Getting Started

CONFIDENTIAL
2
Getting Demo Source

 Spring Samples Repository


• http://src.springsource.org/svn/spring-samples

 Petcare
• http://src.springsource.org/svn/spring-samples/petcare/trunk

 Spring Travel
• http://src.springsource.org/svn/spring-samples/travel/trunk

CONFIDENTIAL
3
I ♥ spring
I ♥ spring
MVC

CONFIDENTIAL
6
Key Features

 @Controller programming model


• For developing web applications and web services
• Configuration namespace

 REST support
• URI Templates
• HTML, JSON, XML, ATOM/RSS representations
• Content Negotiation
• Support for PUT and DELETE requests

 Data Binding and Type Conversion

 Declarative Validation
• JSR-303

CONFIDENTIAL
7
MVC Demo

CONFIDENTIAL

© 2010 SpringSource, A division of VMware. All rights reserved


Ajax

CONFIDENTIAL
9
Key Features

 Integrates well with leading JavaScript toolkits


• jQuery
• Dojo

 Integrates well with popular CSS frameworks


• Blueprint CSS
• 960 Grid

 Spring JavaScript Module (part of Web Flow)


• Server-side partial page rendering built on Tiles composite view system
• Client-side progressive enhancement API built on Dojo
• Widget decorations
• Ajax event decorations
• Client-side validation

CONFIDENTIAL
10
Ajax Demo

CONFIDENTIAL

© 2010 SpringSource, A division of VMware. All rights reserved


Web Flow

CONFIDENTIAL
12
Key Features

 Lets you define flows that guide users through business processes
• Single module, e.g. “Loan Application”, encapsulating all process steps
• Navigation rules strictly enforced server-side

 Manages conversational state


• Isolated from other users
• Local to current window, tab, or dialog
• Cleaned up when flow completes or expires

 Agile development experience


• Change flows without restarting the server

CONFIDENTIAL
13
Web Flow Demo

CONFIDENTIAL

© 2010 SpringSource, A division of VMware. All rights reserved


Security

CONFIDENTIAL
15
Key Features

 Multiple authentication mechanisms


• Basic, Form, OpenID

 Pluggable user data stores


• In Memory, Database, LDAP

 Multiple levels of security


• Web (URL-based, enforced by ServletFilter)
• @Secured method (enforced by AOP)

 Role-based authorization
• Flexible security expressions with Spring EL
• JSP tag library for conditional rendering

 SSL channels
CONFIDENTIAL
16
Security Demo

CONFIDENTIAL

© 2010 SpringSource, A division of VMware. All rights reserved


Integration

CONFIDENTIAL
18
Key Features

 Allows you to add an integration layer to your application


• Connect your application to other systems in a loosely coupled way
• Think messaging!

 Comprehensive support for enterprise integration patterns


• Channel, Router, Filter, Transformer, Splitter, Channel Adapter
• High-level configuration DSL built around these patterns

 Extensive library of channel adapters


• JMS, File, Mail, HTTP, FTP

 Support for asynchronous / parallel workloads

CONFIDENTIAL
19
Integration Pipeline

Message
Gateway Admin Admin Admin
Client Client Client

global appointments

appointment
message router

Logger
asyncMailer

Doctor
doctorMail
Transformer
Mail

I ♥ spring
Integration Demo

CONFIDENTIAL

© 2010 SpringSource, A division of VMware. All rights reserved


Flex

CONFIDENTIAL
22
Key Features

 Export Spring Beans to Flex Clients


• Over AMF (RPC), HTTP (REST)

 Security
• Utilizing Spring Integration

 Integration
• Utilizing Spring Integration; push messages to Flex clients

 Built on top of Spring MVC


• Configuration namespace simplifies setup and configuration
• Plugs into DispatcherServlet processing lifecycle

 Spring ActionScript
• DI / MVC framework for Flex clients
CONFIDENTIAL
23
Tools and Getting Started

CONFIDENTIAL
24
Key Features

 SpringSource Tool-Suite
• New Project Templates (can create your own)
• Essential plugins pre-integrated (Spring IDE, WTP, m2Eclipse, AJDT, Roo, etc)
• Convenient “Spring Extensions” Install
• e.g. install Groovy tooling add-on in one click!
• Content assist / auto-completion
• Visualization
• Embedded tc Server Developer Edition, including Spring Insight
 Roo
• Code generation with round tripping
• Reduced Java ceremony (@RooJavaBean, @RooToString)
• Support for Active Record pattern (@RooEntity)
• UI Scaffolding
• Intelligent command-line shell interface

CONFIDENTIAL
25
Getting Started with Spring

 Download SpringSource Tool Suite


• http://www.springsource.com/products/sts

 Create your first Spring MVC Project


• New -> Spring Template Project -> Spring MVC Project

 Experience Roo
• New -> Roo Project -> Open Roo Shell -> type “hint”

 Study the sample applications


• Checkout Petcare, Spring Travel, import into STS and run on Tomcat

CONFIDENTIAL
26
Roo Demo

CONFIDENTIAL

© 2010 SpringSource, A division of VMware. All rights reserved


Coming in Spring 3.1

 Conversation Scope, Flash Map

 Comet (long-polling) support

 Java @Flow Definitions

 Static resources handler

 OAuth support

 Roo Add-ons
• “Open Web” (HTML/CSS/JS) improvements
• Flex (new)
• GWT (new)

CONFIDENTIAL
28
Resources

 Spring articles and documentation


• http://www.springsource.org/documentation

 Roo webinar and video


• http://www.springsource.org/node/2479
• http://s3.springsource.com/MRKT/roo/2010-01-Five_Minutes_Roo.mov

 Get involved
• Forums: http://forum.springsource.org
• JIRA: http://www.springframework.org

CONFIDENTIAL
29

Você também pode gostar