SlideShare a Scribd company logo
Thorsten Kamann · itemis AG · 15.03.2010
What‘s new, what‘s old?

       Configuration

        OX/Mapper

       REST-Support

MVC, Embedded Database, EE6

   SpringSource Toolsuite

         Spring Roo

           Grails
Spring 3 - Der dritte Frühling
Spring 3 - Der dritte Frühling
-   jUnit 3 Klassen




    Commons Attributes




    Struts 1.x Support
100% API




            Spring
              3
  95%
Extension
 Points
Modules     OSGi




          Enterprise
Maven
          Repository
#{...}
Expression Language   Java Config
#{...}                @Value


         Expression
         Language


XML             ExpressionParser
<bean class=“MyDatabase"> !
  !<property name="databaseName" !
  !   value="#{systemProperties.databaseName}"/> !
  !<property name="keyGenerator" !
  !   value="#{strategyBean.databaseKeyGenerator}"/> !
</bean> !
@Repository !
public class MyDatabase { !
  !@Value("#{systemProperties.databaseName}") !
  !public void setDatabaseName(String dbName) {…} !

  !@Value("#{strategyBean.databaseKeyGenerator}") !
  !public void setKeyGenerator(KeyGenerator kg) {…} !
} !
Database db = new MyDataBase(„myDb“, „uid“, „pwd“);!

ExpressionParser parser = new SpelExpressionParser();!
Expression exp = parser.parseExpression("name");!

EvaluationContext context = new ! ! !

  ! ! ! !StandardEvaluationContext();!
context.setRootObject(db);!

String name = (String) exp.getValue(context);!
Database db = new MyDataBase(„myDb“, „uid“, „pwd“);!

ExpressionParser parser = new SpelExpressionParser();!
Expression exp = parser.parseExpression("name");!

String name = (String) exp.getValue(db);!
@Configuration        @Bean            @DependsOn




  @Primary            @Lazy             @Import




         @ImportResource      @Value
@Configuration!
public class AppConfig {!
   @Value("#{jdbcProperties.url}") !
  !private String jdbcUrl;!
     !!
  !@Value("#{jdbcProperties.username}") !
  !private String username;!

  !@Value("#{jdbcProperties.password}") !
  !private String password;!
}!
@Configuration!
public class AppConfig {!
   @Bean!
  !public FooService fooService() {!
  ! !return new FooServiceImpl(fooRepository());!
   }!

 !@Bean!
  public DataSource dataSource() { !
    !return new DriverManagerDataSource(!
 ! ! !jdbcUrl, username, password);!
   }!

}!
@Configuration!
public class AppConfig {!
   @Bean!
  !public FooRepository fooRepository() {!
  ! !return new HibernateFooRepository !     !   !

  ! ! !(sessionFactory());!
    }!

    @Bean!
    public SessionFactory sessionFactory() {!
  ! !...!
    }!
}!
<context:component-scan !
  !base-package="org.example.config"/>


<util:properties id="jdbcProperties" 

  ! !location="classpath:jdbc.properties"/>!
public static void main(String[] args) {!
    ApplicationContext ctx = !
  ! ! !new AnnotationConfigApplicationContext(!
  ! ! ! ! ! ! ! ! ! ! ! !AppConfig.class);!
    FooService fooService = ctx.getBean(!
  ! ! ! ! ! ! ! ! ! ! ! !FooService.class);!
    fooService.doStuff();!
}!
Spring 3 - Der dritte Frühling
Spring 3 - Der dritte Frühling
<oxm:jaxb2-marshaller !
  !id="marshaller" !
  !contextPath=“my.packages.schema"/>!



<oxm:jaxb2-marshaller id="marshaller">!
    <oxm:class-to-be-bound name=“Customer"/>!
    <oxm:class-to-be-bound name=„Address"/>!
    ...!
</oxm:jaxb2-marshaller>!
<beans>!
    <bean id="castorMarshaller" !
  !class="org.springframework.oxm.castor.CastorMarshaller" >!
      <property name="mappingLocation" 

  ! !value="classpath:mapping.xml" />!
    </bean>!
</beans>

<oxm:xmlbeans-marshaller !
  !id="marshaller“!
  !options=„XMLOptionsFactoryBean“/>!
<oxm:jibx-marshaller !
  !id="marshaller" !
  !target-class=“mypackage.Customer"/>!
<beans>!

   <bean id="xstreamMarshaller"
 !class="org.springframework.oxm.xstream.XStreamMarshaller">!
     <property name="aliases">!
        <props>!
             <prop key=“Customer">mypackage.Customer</prop>!
        </props>!
    !</property>!
   </bean>!
   ...!

</beans>!
Spring 3 - Der dritte Frühling
Spring MVC

@Controller   @RequestMapping   @PathVariable
@Controller

     The C of MVC

  <context:component-
         scan/>

  Mapping to an URI
     (optional)
@RequestMapping

   Mapping a Controller
   or Methods to an URI


       URI-Pattern


   Mapping to a HTTP-
        Method

       Works with
      @PathVariable
@Controller!
@RequestMapping(„/customer“)!
public class CustomerController{!

  !@RequestMapping(method=RequestMethod.GET)!
  !public List<Customer> list(){!
  ! !return customerList;!
  !}!
}!
@Controller!
@RequestMapping(„/customer“)!
public class CustomerController{!

  !@RequestMapping(value=„/list“,!
  ! ! !      method=RequestMethod.GET)!
  !public List<Customer> list(){!
  ! !return customerList;!
  !}!
}!
@Controller!
@RequestMapping(„/customer“)!
public class CustomerController{!

  !@RequestMapping(value=„/show/{customerId}“,!
  ! ! !      method=RequestMethod.GET)!
  !public Customer show(!
  !    @PathVariable(„customerId“) long customerId){!
  ! !return customer;!
  !}!
}!
@Controller!
@RequestMapping(„/customer“)!
public class CustomerController{!

  !@RequestMapping(!
  ! !value=„/show/{customerId}/edit/{addressId}“,!
  ! !method=RequestMethod.GET)!
  !public String editAddressDetails(!
  !    @PathVariable(„customerId“) long customerId,!
  !    @PathVariable(„addressId“) long addressId){!
  ! !return „redirect:...“;!
  !}!
}!
RestTemplate

Delete   Get   Head   Options   Post   Put
Spring 3 - Der dritte Frühling
Host              localhost:8080!
Accept            text/html, application/xml;q=0.9!
Accept-Language   fr,en-gb;q=0.7,en;q=0.3!
Accept-Encoding   gzip,deflate!
Accept-Charset    ISO-8859-1,utf-8;q=0.7,*;q=0.7!
Keep-Alive        300!



public void displayHeaderInfo(!
     @RequestHeader("Accept-Encoding") String encoding,!
     @RequestHeader("Keep-Alive") long keepAlive) {!

 !...!

}!
JSR-303


public class VistorForm(!
  !@NotNull!
   @Size(max=40)!
  !private String name;!

  !@Min(18)!
  !private int age;!
}!



<bean id="validator" !
  !class=“...LocalValidatorFactoryBean" />!
HSQL   H2   Derby   ...
<jdbc:embedded-database id="dataSource">!
      <jdbc:script !
  ! ! !location="classpath:schema.sql"/>!
      <jdbc:script !
  ! ! !location="classpath:test-data.sql"/>!
</jdbc:embedded-database>!


EmbeddedDatabaseBuilder builder = new ! !

  ! ! ! !EmbeddedDatabaseBuilder();!
EmbeddedDatabase db = builder.setType(H2)!
  ! ! ! !.addScript(“schema.sql")!
  ! ! ! !.addScript(„test-data.sql")!
  ! ! ! !.build();!
//Do somethings: db extends DataSource!
db.shutdown();!
public class DataBaseTest {!
    private EmbeddedDatabase db;!

   @Before!
   public void setUp() {!
 ! !db = new EmbeddedDatabaseBuilder()!
 ! ! ! !.addDefaultScripts().build();!    !!
   }!

   @Test!
   public void testDataAccess() {!
       JdbcTemplate template = !
 ! ! ! ! !new JdbcTemplate(db);!
       template.query(...);!
   }!

     @After!
     public void tearDown() {!
         db.shutdown();!
     }!
}!
@Async (out
of EJB 3.1)



 JSR-303




  JSF 2.0




  JPA 2
Spring 3 - Der dritte Frühling
• Spring project,              • OSGi bundle                                • Support for all the
Spring Application Tools




                                                   OSGi




                                                                                Flexible Deployments
                             bean and XML file              overview and                                 most common
                             wizards                        visual dependency                            Java EE
                           • Graphical Spring               graph                                        application
                             configuration                • Classpath                                    servers
                             editor                         management                                 • Advanced support
                           • Spring 3.0 support             based on OSGi                                for SpringSource
                             including                      meta data                                    dm Server
                             @Configuration               • Automatic                                  • Advanced support
                             and @Bean styles               generation of                                for SpringSource
                           • Spring Web Flow                manifest                                     tc Server
                             and Spring Batch               dependency meta                            • Cloud Foundry
                             visual                         data                                         targeting for dm
                             development tools            • SpringSource                                 Server and tc
                           • Spring Roo project             Enterprise Bundle                            Server
                             wizard and                     Repository                                 • VMware Lab
                             development shell              browser                                      Manager and
                           • Spring                       • Manifest file                                Workstation
                             Application blue               validation and                               integration and
                             prints and best                best practice                                deployment
                             practice validation            recommendations
Spring 3 - Der dritte Frühling
Spring 3 - Der dritte Frühling
Spring 3 - Der dritte Frühling
Spring 3 - Der dritte Frühling
Spring 3 - Der dritte Frühling
Grails for   Spring Best
                           AOP-driven
  Java        Practices


                      Nice
      Test-driven
                     Console
@Roo*
Command                      AspectJ
             Annotations
Line Shell                  Intertype     Metadata   RoundTrip
              (Source-
                           Declarations
               Level)
Spring 3 - Der dritte Frühling
Spring 3 - Der dritte Frühling
Spring 3 - Der dritte Frühling
roo> project --topLevelPackage com.tenminutes
roo> persistence setup --provider HIBERNATE
         --database HYPERSONIC_IN_MEMORY
roo> entity --class ~.Timer --testAutomatically
roo> field string --fieldName message --notNull
roo> controller all --package ~.web
roo> selenium test --controller ~.web.TimerController
roo> perform tests
roo> perform package
roo> perform eclipse
roo> quit
$ mvn tomcat:run
Spring 3 - Der dritte Frühling
Spring 3 - Der dritte Frühling
Roo for     Best      Groovy-
Groovy    Practices   driven

       Test-     Nice
      driven    Console
Have your next Web 2.0      Get instant feedback,   Powered by Spring,
project done in weeks       See instant results.    Grails out performs the
instead of months.          Grails is the premier   competition. Dynamic,
Grails delivers a new       dynamic language        agile web development
age of Java web             web framework for the   without compromises.
application productivity.   JVM.



Rapid                       Dynamic                 Robust
Support
                                    Grails Project
Project Wizard   different Grails
                                     Converter
                     Versions


                                      Grails
                  Full Groovy
Grails Tooling                       Command
                   Support
                                      Prompt
Spring 3 - Der dritte Frühling
CTRL+ALT+G (or CMD+ALT+G on Macs)
Spring 3 - Der dritte Frühling
>grails create-app tenminutes-grails!
<grails create-domain-class tenminutes.domain.Timer!

Timer.groovy:!
class Timer {!
   !String message!
      !static constraints = {!
   ! !message(nullable: false)!
      !}!
}!

>grails create-controller tenminutes.web.TimerController!

TimerController.groovy:!
class TimerControllerController {!
   !def scaffold = Timer!
}!

>grails run-app!
Spring 3 - Der dritte Frühling
Spring 3 - Der dritte Frühling
•  http://www.springframework.org/
Spring     •  http://www.springsource.com/



Grails &   •  http://www.grails.org/
           •  http://groovy.codehaus.org/
Groovy
           •  http://www.thorsten-kamann.de
Extras     •  http://www.itemis.de

More Related Content

PDF
Spring 3 - An Introduction
PDF
Webtests Reloaded - Webtest with Selenium, TestNG, Groovy and Maven
PDF
Boston 2011 OTN Developer Days - Java EE 6
PPT
Ruby On Rails Seminar Basis Softexpo Feb2010
PDF
Service Oriented Integration with ServiceMix
KEY
Multi Client Development with Spring
PPT
Struts N E W
PDF
Content-Driven Web Applications with Magnolia CMS and Ruby on Rails
Spring 3 - An Introduction
Webtests Reloaded - Webtest with Selenium, TestNG, Groovy and Maven
Boston 2011 OTN Developer Days - Java EE 6
Ruby On Rails Seminar Basis Softexpo Feb2010
Service Oriented Integration with ServiceMix
Multi Client Development with Spring
Struts N E W
Content-Driven Web Applications with Magnolia CMS and Ruby on Rails

What's hot (19)

PPTX
Apache servicemix1
PPT
Ruby On Rails Tutorial
PPTX
Resthub lyonjug
PPT
Spring MVC
PDF
JavaServer Faces 2.0 - JavaOne India 2011
PDF
J2EE jsp_01
PDF
Java Web Programming [5/9] : EL, JSTL and Custom Tags
PPTX
Resthub framework presentation
PDF
10 jsp-scripting-elements
PDF
Tuning Web Performance
PDF
IBM WebSphere Portal Integrator for SAP - Escenario de ejemplo.
KEY
MVC on the server and on the client
PDF
Advanced Visualforce Webinar
PDF
Lap trinh web [Slide jsp]
PPTX
Building and managing java projects with maven part-III
PDF
Spring mvc
PPTX
Spring MVC
PPTX
ADP- Chapter 3 Implementing Inter-Servlet Communication
TXT
Jsp Notes
Apache servicemix1
Ruby On Rails Tutorial
Resthub lyonjug
Spring MVC
JavaServer Faces 2.0 - JavaOne India 2011
J2EE jsp_01
Java Web Programming [5/9] : EL, JSTL and Custom Tags
Resthub framework presentation
10 jsp-scripting-elements
Tuning Web Performance
IBM WebSphere Portal Integrator for SAP - Escenario de ejemplo.
MVC on the server and on the client
Advanced Visualforce Webinar
Lap trinh web [Slide jsp]
Building and managing java projects with maven part-III
Spring mvc
Spring MVC
ADP- Chapter 3 Implementing Inter-Servlet Communication
Jsp Notes
Ad

Viewers also liked (20)

PDF
AutoPagerize Shibuya.js 2007 9/15
PPT
Juliane
 
PPS
Richardgere
PPT
PPT
Berufsreife Englisch
PPTX
1. imagen y discurso säarbrucken
PPS
My Picxs
PPT
Language Educators: Shaping the Future in a New Era!
PPT
Michael
 
PPT
Charlotte
 
PPT
Nina
 
PPT
лезин
PPT
An Adarsha Bharatiya Naari
PPT
Hi! I Am Wayne Rooney
PPT
Salik
 
PPS
我就是喜歡這樣的你
PPT
Selected to Stereotype - Donelan
PPT
Voct innovatie in commercieel proces 1
PDF
Arduino yun × apiで遊んでみる
PDF
Soche 2008 Blogs Wikis
AutoPagerize Shibuya.js 2007 9/15
Juliane
 
Richardgere
Berufsreife Englisch
1. imagen y discurso säarbrucken
My Picxs
Language Educators: Shaping the Future in a New Era!
Michael
 
Charlotte
 
Nina
 
лезин
An Adarsha Bharatiya Naari
Hi! I Am Wayne Rooney
Salik
 
我就是喜歡這樣的你
Selected to Stereotype - Donelan
Voct innovatie in commercieel proces 1
Arduino yun × apiで遊んでみる
Soche 2008 Blogs Wikis
Ad

Similar to Spring 3 - Der dritte Frühling (20)

PPT
Spring and Cloud Foundry; a Marriage Made in Heaven
PDF
04.egovFrame Runtime Environment Workshop
PDF
Introducing spring
PDF
Spark IT 2011 - Java EE 6 Workshop
KEY
Enterprise Java Web Application Frameworks Sample Stack Implementation
ODP
Java EE and Glassfish
PDF
Java EE / GlassFish Strategy & Roadmap @ JavaOne 2011
KEY
Spring in the Cloud - using Spring with Cloud Foundry
PDF
Introduction to Apache Camel
KEY
A Walking Tour of (almost) all of Springdom
PDF
MongoDB for Java Devs with Spring Data - MongoPhilly 2011
PPT
Spring 3.1: a Walking Tour
PDF
GlassFish REST Administration Backend
DOC
J2EE Online Training
PDF
Expendables E-AppStore
PDF
GlassFish REST Administration Backend at JavaOne India 2012
PDF
The spring 32 update final
PDF
Understanding the nuts & bolts of Java EE 6
PDF
Java EE 與 雲端運算的展望
PDF
JavaOne 2010: OSGI Migrat
Spring and Cloud Foundry; a Marriage Made in Heaven
04.egovFrame Runtime Environment Workshop
Introducing spring
Spark IT 2011 - Java EE 6 Workshop
Enterprise Java Web Application Frameworks Sample Stack Implementation
Java EE and Glassfish
Java EE / GlassFish Strategy & Roadmap @ JavaOne 2011
Spring in the Cloud - using Spring with Cloud Foundry
Introduction to Apache Camel
A Walking Tour of (almost) all of Springdom
MongoDB for Java Devs with Spring Data - MongoPhilly 2011
Spring 3.1: a Walking Tour
GlassFish REST Administration Backend
J2EE Online Training
Expendables E-AppStore
GlassFish REST Administration Backend at JavaOne India 2012
The spring 32 update final
Understanding the nuts & bolts of Java EE 6
Java EE 與 雲端運算的展望
JavaOne 2010: OSGI Migrat

More from Thorsten Kamann (12)

PDF
Scrum on rails
PPTX
Scrum and distributed teams
PPTX
Effizente Entwicklung für verteilte Projekte
PDF
My Daily Spring - Best Practices with the Springframework
PDF
Vortragsreihe Dortmund: Unified Development Environments
PPT
Leichtgewichtige Architekturen mit Spring, JPA, Maven und Groovy
PDF
Let’s groove with Groovy
PDF
Groovy - Rocks or Not?
PDF
Maven2 - Die nächste Generation des Buildmanagements?
PDF
Spring 2.0
PDF
Spring 2.0
PDF
Leichtgewichtige Architekturen mit Spring, JPA, Maven und Groovy
Scrum on rails
Scrum and distributed teams
Effizente Entwicklung für verteilte Projekte
My Daily Spring - Best Practices with the Springframework
Vortragsreihe Dortmund: Unified Development Environments
Leichtgewichtige Architekturen mit Spring, JPA, Maven und Groovy
Let’s groove with Groovy
Groovy - Rocks or Not?
Maven2 - Die nächste Generation des Buildmanagements?
Spring 2.0
Spring 2.0
Leichtgewichtige Architekturen mit Spring, JPA, Maven und Groovy

Recently uploaded (20)

PPT
Teaching material agriculture food technology
PDF
Approach and Philosophy of On baking technology
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPTX
A Presentation on Artificial Intelligence
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Electronic commerce courselecture one. Pdf
PDF
KodekX | Application Modernization Development
PDF
Machine learning based COVID-19 study performance prediction
PDF
Modernizing your data center with Dell and AMD
Teaching material agriculture food technology
Approach and Philosophy of On baking technology
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Reach Out and Touch Someone: Haptics and Empathic Computing
Understanding_Digital_Forensics_Presentation.pptx
MYSQL Presentation for SQL database connectivity
Unlocking AI with Model Context Protocol (MCP)
Review of recent advances in non-invasive hemoglobin estimation
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
A Presentation on Artificial Intelligence
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
The Rise and Fall of 3GPP – Time for a Sabbatical?
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
NewMind AI Monthly Chronicles - July 2025
Chapter 3 Spatial Domain Image Processing.pdf
Electronic commerce courselecture one. Pdf
KodekX | Application Modernization Development
Machine learning based COVID-19 study performance prediction
Modernizing your data center with Dell and AMD

Spring 3 - Der dritte Frühling

  • 1. Thorsten Kamann · itemis AG · 15.03.2010
  • 2. What‘s new, what‘s old? Configuration OX/Mapper REST-Support MVC, Embedded Database, EE6 SpringSource Toolsuite Spring Roo Grails
  • 5. - jUnit 3 Klassen Commons Attributes Struts 1.x Support
  • 6. 100% API Spring 3 95% Extension Points
  • 7. Modules OSGi Enterprise Maven Repository
  • 9. #{...} @Value Expression Language XML ExpressionParser
  • 10. <bean class=“MyDatabase"> ! !<property name="databaseName" ! ! value="#{systemProperties.databaseName}"/> ! !<property name="keyGenerator" ! ! value="#{strategyBean.databaseKeyGenerator}"/> ! </bean> !
  • 11. @Repository ! public class MyDatabase { ! !@Value("#{systemProperties.databaseName}") ! !public void setDatabaseName(String dbName) {…} ! !@Value("#{strategyBean.databaseKeyGenerator}") ! !public void setKeyGenerator(KeyGenerator kg) {…} ! } !
  • 12. Database db = new MyDataBase(„myDb“, „uid“, „pwd“);! ExpressionParser parser = new SpelExpressionParser();! Expression exp = parser.parseExpression("name");! EvaluationContext context = new ! ! !
 ! ! ! !StandardEvaluationContext();! context.setRootObject(db);! String name = (String) exp.getValue(context);!
  • 13. Database db = new MyDataBase(„myDb“, „uid“, „pwd“);! ExpressionParser parser = new SpelExpressionParser();! Expression exp = parser.parseExpression("name");! String name = (String) exp.getValue(db);!
  • 14. @Configuration @Bean @DependsOn @Primary @Lazy @Import @ImportResource @Value
  • 15. @Configuration! public class AppConfig {! @Value("#{jdbcProperties.url}") ! !private String jdbcUrl;! !! !@Value("#{jdbcProperties.username}") ! !private String username;! !@Value("#{jdbcProperties.password}") ! !private String password;! }!
  • 16. @Configuration! public class AppConfig {! @Bean! !public FooService fooService() {! ! !return new FooServiceImpl(fooRepository());! }! !@Bean! public DataSource dataSource() { ! !return new DriverManagerDataSource(! ! ! !jdbcUrl, username, password);! }! }!
  • 17. @Configuration! public class AppConfig {! @Bean! !public FooRepository fooRepository() {! ! !return new HibernateFooRepository ! ! !
 ! ! !(sessionFactory());! }! @Bean! public SessionFactory sessionFactory() {! ! !...! }! }!
  • 18. <context:component-scan ! !base-package="org.example.config"/>
 <util:properties id="jdbcProperties" 
 ! !location="classpath:jdbc.properties"/>!
  • 19. public static void main(String[] args) {! ApplicationContext ctx = ! ! ! !new AnnotationConfigApplicationContext(! ! ! ! ! ! ! ! ! ! ! ! !AppConfig.class);! FooService fooService = ctx.getBean(! ! ! ! ! ! ! ! ! ! ! ! !FooService.class);! fooService.doStuff();! }!
  • 22. <oxm:jaxb2-marshaller ! !id="marshaller" ! !contextPath=“my.packages.schema"/>! <oxm:jaxb2-marshaller id="marshaller">! <oxm:class-to-be-bound name=“Customer"/>! <oxm:class-to-be-bound name=„Address"/>! ...! </oxm:jaxb2-marshaller>!
  • 23. <beans>! <bean id="castorMarshaller" ! !class="org.springframework.oxm.castor.CastorMarshaller" >! <property name="mappingLocation" 
 ! !value="classpath:mapping.xml" />! </bean>! </beans>

  • 24. <oxm:xmlbeans-marshaller ! !id="marshaller“! !options=„XMLOptionsFactoryBean“/>!
  • 25. <oxm:jibx-marshaller ! !id="marshaller" ! !target-class=“mypackage.Customer"/>!
  • 26. <beans>! <bean id="xstreamMarshaller" !class="org.springframework.oxm.xstream.XStreamMarshaller">! <property name="aliases">! <props>! <prop key=“Customer">mypackage.Customer</prop>! </props>! !</property>! </bean>! ...! </beans>!
  • 28. Spring MVC @Controller @RequestMapping @PathVariable
  • 29. @Controller The C of MVC <context:component- scan/> Mapping to an URI (optional)
  • 30. @RequestMapping Mapping a Controller or Methods to an URI URI-Pattern Mapping to a HTTP- Method Works with @PathVariable
  • 31. @Controller! @RequestMapping(„/customer“)! public class CustomerController{! !@RequestMapping(method=RequestMethod.GET)! !public List<Customer> list(){! ! !return customerList;! !}! }!
  • 32. @Controller! @RequestMapping(„/customer“)! public class CustomerController{! !@RequestMapping(value=„/list“,! ! ! ! method=RequestMethod.GET)! !public List<Customer> list(){! ! !return customerList;! !}! }!
  • 33. @Controller! @RequestMapping(„/customer“)! public class CustomerController{! !@RequestMapping(value=„/show/{customerId}“,! ! ! ! method=RequestMethod.GET)! !public Customer show(! ! @PathVariable(„customerId“) long customerId){! ! !return customer;! !}! }!
  • 34. @Controller! @RequestMapping(„/customer“)! public class CustomerController{! !@RequestMapping(! ! !value=„/show/{customerId}/edit/{addressId}“,! ! !method=RequestMethod.GET)! !public String editAddressDetails(! ! @PathVariable(„customerId“) long customerId,! ! @PathVariable(„addressId“) long addressId){! ! !return „redirect:...“;! !}! }!
  • 35. RestTemplate Delete Get Head Options Post Put
  • 37. Host localhost:8080! Accept text/html, application/xml;q=0.9! Accept-Language fr,en-gb;q=0.7,en;q=0.3! Accept-Encoding gzip,deflate! Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7! Keep-Alive 300! public void displayHeaderInfo(! @RequestHeader("Accept-Encoding") String encoding,! @RequestHeader("Keep-Alive") long keepAlive) {! !...! }!
  • 38. JSR-303 public class VistorForm(! !@NotNull! @Size(max=40)! !private String name;! !@Min(18)! !private int age;! }! <bean id="validator" ! !class=“...LocalValidatorFactoryBean" />!
  • 39. HSQL H2 Derby ...
  • 40. <jdbc:embedded-database id="dataSource">! <jdbc:script ! ! ! !location="classpath:schema.sql"/>! <jdbc:script ! ! ! !location="classpath:test-data.sql"/>! </jdbc:embedded-database>! EmbeddedDatabaseBuilder builder = new ! !
 ! ! ! !EmbeddedDatabaseBuilder();! EmbeddedDatabase db = builder.setType(H2)! ! ! ! !.addScript(“schema.sql")! ! ! ! !.addScript(„test-data.sql")! ! ! ! !.build();! //Do somethings: db extends DataSource! db.shutdown();!
  • 41. public class DataBaseTest {! private EmbeddedDatabase db;! @Before! public void setUp() {! ! !db = new EmbeddedDatabaseBuilder()! ! ! ! !.addDefaultScripts().build();! !! }! @Test! public void testDataAccess() {! JdbcTemplate template = ! ! ! ! ! !new JdbcTemplate(db);! template.query(...);! }! @After! public void tearDown() {! db.shutdown();! }! }!
  • 42. @Async (out of EJB 3.1) JSR-303 JSF 2.0 JPA 2
  • 44. • Spring project, • OSGi bundle • Support for all the Spring Application Tools OSGi Flexible Deployments bean and XML file overview and most common wizards visual dependency Java EE • Graphical Spring graph application configuration • Classpath servers editor management • Advanced support • Spring 3.0 support based on OSGi for SpringSource including meta data dm Server @Configuration • Automatic • Advanced support and @Bean styles generation of for SpringSource • Spring Web Flow manifest tc Server and Spring Batch dependency meta • Cloud Foundry visual data targeting for dm development tools • SpringSource Server and tc • Spring Roo project Enterprise Bundle Server wizard and Repository • VMware Lab development shell browser Manager and • Spring • Manifest file Workstation Application blue validation and integration and prints and best best practice deployment practice validation recommendations
  • 50. Grails for Spring Best AOP-driven Java Practices Nice Test-driven Console
  • 51. @Roo* Command AspectJ Annotations Line Shell Intertype Metadata RoundTrip (Source- Declarations Level)
  • 55. roo> project --topLevelPackage com.tenminutes roo> persistence setup --provider HIBERNATE --database HYPERSONIC_IN_MEMORY roo> entity --class ~.Timer --testAutomatically roo> field string --fieldName message --notNull roo> controller all --package ~.web roo> selenium test --controller ~.web.TimerController roo> perform tests roo> perform package roo> perform eclipse roo> quit $ mvn tomcat:run
  • 58. Roo for Best Groovy- Groovy Practices driven Test- Nice driven Console
  • 59. Have your next Web 2.0 Get instant feedback, Powered by Spring, project done in weeks See instant results. Grails out performs the instead of months. Grails is the premier competition. Dynamic, Grails delivers a new dynamic language agile web development age of Java web web framework for the without compromises. application productivity. JVM. Rapid Dynamic Robust
  • 60. Support Grails Project Project Wizard different Grails Converter Versions Grails Full Groovy Grails Tooling Command Support Prompt
  • 64. >grails create-app tenminutes-grails! <grails create-domain-class tenminutes.domain.Timer! Timer.groovy:! class Timer {! !String message! !static constraints = {! ! !message(nullable: false)! !}! }! >grails create-controller tenminutes.web.TimerController! TimerController.groovy:! class TimerControllerController {! !def scaffold = Timer! }! >grails run-app!
  • 67. •  http://www.springframework.org/ Spring •  http://www.springsource.com/ Grails & •  http://www.grails.org/ •  http://groovy.codehaus.org/ Groovy •  http://www.thorsten-kamann.de Extras •  http://www.itemis.de