SlideShare ist ein Scribd-Unternehmen logo
1 von 67
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
-   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();!
}!
<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 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
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 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
Grails for   Spring Best
                           AOP-driven
  Java        Practices


                      Nice
      Test-driven
                     Console
@Roo*
Command                      AspectJ
             Annotations
Line Shell                  Intertype     Metadata   RoundTrip
              (Source-
                           Declarations
               Level)
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
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
CTRL+ALT+G (or CMD+ALT+G on Macs)
>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!
•  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

Weitere ähnliche Inhalte

Was ist angesagt?

Ruby On Rails Tutorial
Ruby On Rails TutorialRuby On Rails Tutorial
Ruby On Rails Tutorial
sunniboy
 
Tuning Web Performance
Tuning Web PerformanceTuning Web Performance
Tuning Web Performance
Eric ShangKuan
 
IBM WebSphere Portal Integrator for SAP - Escenario de ejemplo.
IBM WebSphere Portal Integrator for SAP - Escenario de ejemplo.IBM WebSphere Portal Integrator for SAP - Escenario de ejemplo.
IBM WebSphere Portal Integrator for SAP - Escenario de ejemplo.
Dacartec Servicios Informáticos
 

Was ist angesagt? (19)

Apache servicemix1
Apache servicemix1Apache servicemix1
Apache servicemix1
 
Ruby On Rails Tutorial
Ruby On Rails TutorialRuby On Rails Tutorial
Ruby On Rails Tutorial
 
Resthub lyonjug
Resthub lyonjugResthub lyonjug
Resthub lyonjug
 
Spring MVC
Spring MVCSpring MVC
Spring MVC
 
JavaServer Faces 2.0 - JavaOne India 2011
JavaServer Faces 2.0 - JavaOne India 2011JavaServer Faces 2.0 - JavaOne India 2011
JavaServer Faces 2.0 - JavaOne India 2011
 
J2EE jsp_01
J2EE jsp_01J2EE jsp_01
J2EE jsp_01
 
Java Web Programming [5/9] : EL, JSTL and Custom Tags
Java Web Programming [5/9] : EL, JSTL and Custom TagsJava Web Programming [5/9] : EL, JSTL and Custom Tags
Java Web Programming [5/9] : EL, JSTL and Custom Tags
 
Resthub framework presentation
Resthub framework presentationResthub framework presentation
Resthub framework presentation
 
10 jsp-scripting-elements
10 jsp-scripting-elements10 jsp-scripting-elements
10 jsp-scripting-elements
 
Tuning Web Performance
Tuning Web PerformanceTuning Web Performance
Tuning Web Performance
 
IBM WebSphere Portal Integrator for SAP - Escenario de ejemplo.
IBM WebSphere Portal Integrator for SAP - Escenario de ejemplo.IBM WebSphere Portal Integrator for SAP - Escenario de ejemplo.
IBM WebSphere Portal Integrator for SAP - Escenario de ejemplo.
 
MVC on the server and on the client
MVC on the server and on the clientMVC on the server and on the client
MVC on the server and on the client
 
Advanced Visualforce Webinar
Advanced Visualforce WebinarAdvanced Visualforce Webinar
Advanced Visualforce Webinar
 
Lap trinh web [Slide jsp]
Lap trinh web [Slide jsp]Lap trinh web [Slide jsp]
Lap trinh web [Slide jsp]
 
Building and managing java projects with maven part-III
Building and managing java projects with maven part-IIIBuilding and managing java projects with maven part-III
Building and managing java projects with maven part-III
 
Spring mvc
Spring mvcSpring mvc
Spring mvc
 
Spring MVC
Spring MVCSpring MVC
Spring MVC
 
ADP- Chapter 3 Implementing Inter-Servlet Communication
ADP- Chapter 3 Implementing Inter-Servlet CommunicationADP- Chapter 3 Implementing Inter-Servlet Communication
ADP- Chapter 3 Implementing Inter-Servlet Communication
 
Jsp Notes
Jsp NotesJsp Notes
Jsp Notes
 

Andere mochten auch

AutoPagerize Shibuya.js 2007 9/15
AutoPagerize Shibuya.js 2007 9/15AutoPagerize Shibuya.js 2007 9/15
AutoPagerize Shibuya.js 2007 9/15
swdyh
 
Juliane
JulianeJuliane
Juliane
eka
 
Michael
MichaelMichael
Michael
eka
 
Charlotte
CharlotteCharlotte
Charlotte
eka
 
Nina
NinaNina
Nina
eka
 
Hi! I Am Wayne Rooney
Hi! I Am Wayne RooneyHi! I Am Wayne Rooney
Hi! I Am Wayne Rooney
waynerooney
 
Salik
SalikSalik
Salik
eka
 
我就是喜歡這樣的你
我就是喜歡這樣的你我就是喜歡這樣的你
我就是喜歡這樣的你
Tingirl Yang
 
Soche 2008 Blogs Wikis
Soche 2008 Blogs WikisSoche 2008 Blogs Wikis
Soche 2008 Blogs Wikis
Rudy Garns
 

Andere mochten auch (20)

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

Ähnlich wie Spring 3 - Der dritte Frühling

Enterprise Java Web Application Frameworks Sample Stack Implementation
Enterprise Java Web Application Frameworks   Sample Stack ImplementationEnterprise Java Web Application Frameworks   Sample Stack Implementation
Enterprise Java Web Application Frameworks Sample Stack Implementation
Mert Çalışkan
 
Rediscovering Spring with Spring Boot(1)
Rediscovering Spring with Spring Boot(1)Rediscovering Spring with Spring Boot(1)
Rediscovering Spring with Spring Boot(1)
Gunith Devasurendra
 
Software architectures for the cloud
Software architectures for the cloudSoftware architectures for the cloud
Software architectures for the cloud
Georgios Gousios
 

Ähnlich wie Spring 3 - Der dritte Frühling (20)

Enterprise Java Web Application Frameworks Sample Stack Implementation
Enterprise Java Web Application Frameworks   Sample Stack ImplementationEnterprise Java Web Application Frameworks   Sample Stack Implementation
Enterprise Java Web Application Frameworks Sample Stack Implementation
 
AEM Sightly Deep Dive
AEM Sightly Deep DiveAEM Sightly Deep Dive
AEM Sightly Deep Dive
 
Rediscovering Spring with Spring Boot(1)
Rediscovering Spring with Spring Boot(1)Rediscovering Spring with Spring Boot(1)
Rediscovering Spring with Spring Boot(1)
 
Spring 3.1: a Walking Tour
Spring 3.1: a Walking TourSpring 3.1: a Walking Tour
Spring 3.1: a Walking Tour
 
StackMate - CloudFormation for CloudStack
StackMate - CloudFormation for CloudStackStackMate - CloudFormation for CloudStack
StackMate - CloudFormation for CloudStack
 
04.egovFrame Runtime Environment Workshop
04.egovFrame Runtime Environment Workshop04.egovFrame Runtime Environment Workshop
04.egovFrame Runtime Environment Workshop
 
dokumen.tips_rediscovering-spring-with-spring-boot1 (1).pdf
dokumen.tips_rediscovering-spring-with-spring-boot1 (1).pdfdokumen.tips_rediscovering-spring-with-spring-boot1 (1).pdf
dokumen.tips_rediscovering-spring-with-spring-boot1 (1).pdf
 
dokumen.tips_rediscovering-spring-with-spring-boot1.pdf
dokumen.tips_rediscovering-spring-with-spring-boot1.pdfdokumen.tips_rediscovering-spring-with-spring-boot1.pdf
dokumen.tips_rediscovering-spring-with-spring-boot1.pdf
 
Developer’s intro to the alfresco platform
Developer’s intro to the alfresco platformDeveloper’s intro to the alfresco platform
Developer’s intro to the alfresco platform
 
Deep Dive: Alfresco Core Repository (... embedded in a micro-services style a...
Deep Dive: Alfresco Core Repository (... embedded in a micro-services style a...Deep Dive: Alfresco Core Repository (... embedded in a micro-services style a...
Deep Dive: Alfresco Core Repository (... embedded in a micro-services style a...
 
BP-6 Repository Customization Best Practices
BP-6 Repository Customization Best PracticesBP-6 Repository Customization Best Practices
BP-6 Repository Customization Best Practices
 
Rapidly Building Data Driven Web Pages with Dynamic ADO.NET
Rapidly Building Data Driven Web Pages with Dynamic ADO.NETRapidly Building Data Driven Web Pages with Dynamic ADO.NET
Rapidly Building Data Driven Web Pages with Dynamic ADO.NET
 
Learning to run
Learning to runLearning to run
Learning to run
 
Google App Engine At A Glance
Google App Engine At A GlanceGoogle App Engine At A Glance
Google App Engine At A Glance
 
Software architectures for the cloud
Software architectures for the cloudSoftware architectures for the cloud
Software architectures for the cloud
 
SharePoint 2010 as a Development Platform
SharePoint 2010 as a Development PlatformSharePoint 2010 as a Development Platform
SharePoint 2010 as a Development Platform
 
Introducing spring
Introducing springIntroducing spring
Introducing spring
 
PLAT-8 Spring Web Scripts and Spring Surf
PLAT-8 Spring Web Scripts and Spring SurfPLAT-8 Spring Web Scripts and Spring Surf
PLAT-8 Spring Web Scripts and Spring Surf
 
Salesforce Lightning Web Components Overview
Salesforce Lightning Web Components OverviewSalesforce Lightning Web Components Overview
Salesforce Lightning Web Components Overview
 
Avatar 2.0
Avatar 2.0Avatar 2.0
Avatar 2.0
 

Mehr von Thorsten Kamann

Mehr von Thorsten Kamann (12)

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

Kürzlich hochgeladen

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 

Kürzlich hochgeladen (20)

Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 

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
  • 3.
  • 4.
  • 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();! }!
  • 20.
  • 21.
  • 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>!
  • 27.
  • 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
  • 36.
  • 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
  • 43.
  • 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
  • 45.
  • 46.
  • 47.
  • 48.
  • 49.
  • 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)
  • 52.
  • 53.
  • 54.
  • 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
  • 56.
  • 57.
  • 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
  • 61.
  • 63.
  • 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!
  • 65.
  • 66.
  • 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