Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.
Spring<XML> est mort Vive Spring NoXML      par Gildas Cuisinier          @gcuisinier
whois(@gcuisinier)Maître Artisan Développeur, Sfeir Benelux    Initiateur de la section Spring de              @Developpez...
Spring ?
Spring ?              es            nc          da        en                              AO         ép                   ...
Retour en 2004
Retour en 2004
Spring 1.0
Spring 1.01 <bean id="monBean" class="be.hikage.service.MyService">2     <property name="version" value="maVersion"/>3 </b...
Spring 1.0 1   <bean id="monBean" class="be.hikage.service.MyService"> 2       <property name="version" value="maVersion"/...
Spring 1.2
Spring 1.21 <bean id="monBean" class="be.hikage.service.MyService">2     <property name="version" value="maVersion"/>3 </b...
Spring 1.21   <bean id="monBean" class="be.hikage.service.MyService">2       <property name="version" value="maVersion"/>3...
Spring 1.2
">                                                                                Proxy                                   ...
Spring 2.0 1 <security:http auto-config="true"> 2     <security:intercept-url pattern="/login*" 3                         ...
Spring 2.5 1 @Controller 2 public class MyController { 3 4     private MyService myService; 5 6     @Autowired 7     publi...
Spring 2.5 1 @Controller 2 public class MyController { 3 4     private MyService myService; 5 6     @Autowired 7     publi...
Spring 3.01 @Configuration2 public class ApplicationConfig {34     @Bean5     public MyService myService() {6         retu...
Spring 3.01 @Configuration   // <beans>2 public class ApplicationConfig {34     @Bean        //<bean id="myService>5     p...
Spring 3.0               1 @Configuration   // <beans>               2 public class ApplicationConfig {               3   ...
Spring 3.01 @Component2 public class MyTask {34     @Scheduled(cron="* * * * *")5     public void execute() {6         // ...
Spring 3.01 @Component2 public class MyTask {34     @Scheduled(cron="* * * * *")5     public void execute() {6         // ...
Spring 3.01 @Component2 public class MyTask {34     @Scheduled(cron="* * * * *")5     public void execute() {6         // ...
Spring 3.1@nnotations ++
@ComponentScan1 <context:component-scan      base-package="be.hikage"/>1 @Configuration2 @ComponentScan("be.hikage")3 publ...
@ComponentScan1 <context:component-scan      base-package="be.hikage"/>1 @Configuration2 @ComponentScan("be.hikage")3 publ...
@EnableScheduling1 public class MaTache {23    @Scheduled(fixedRate = 1000)4     public void execute() {5         System.o...
@EnableScheduling1 <task:annotation-driven />
@EnableScheduling1 <task:annotation-driven />1   @Configuration2   @EnableScheduling3   public class ApplicationConfig {4 ...
@EnableScheduling1   @Target(ElementType.TYPE)2   @Retention(RetentionPolicy.RUNTIME)3   @Import(SchedulingConfiguration.c...
@EnableScheduling 1 @Configuration 2 public class SchedulingConfiguration { 3 4     @Bean(name=AnnotationConfigUtils.SCHED...
@EnableCaching 1 @Service 2 public class CalculateurPrix { 3 4     @Cacheable(value = "price") 5     public Double calcule...
@EnableCaching 1 @Service 2 public class CalculateurPrix { 3 4     @Cacheable(value = "price") 5     public Double calcule...
@EnableCaching1 <caching:annotation-driven />23     <bean class="org.springframework.cache    .concurrent.ConcurrentMapCac...
@EnableCaching 1   @Configuration 2   @EnableCaching 3   public class ApplicationConfig { 4 5       @Bean 6       CacheMan...
Abstraction de CacheOut of the Box ConcurrentHashMap EhCacheGemFireJCache (Spring 3.2/3.3)
@EnableWebMvc1 <mvc:annotation-driven />
@EnableWebMvc1 <mvc:annotation-driven />1   @Configuration2   @EnableWebMvc3   public class WebConfig {4   }
@EnableWebMvc1 <mvc:annotation-driven/>2 <mvc:interceptors>3     <bean class="osf..LocaleChangeInterceptor"/>4 </mvc:inter...
@EnableWebMvc +     WebMvcConfigurerAdapter 1   @Configuration 2   @EnableWebMvc 3   public class WebConfig 4       extend...
@EnableWebMvc
@EnableWebMvcAjout Intercepteur
@EnableWebMvcAjout IntercepteurConfiguration de ViewController
@EnableWebMvcAjout IntercepteurConfiguration de ViewController Ajout de ResourceHandler
@EnableWebMvcAjout IntercepteurConfiguration de ViewController Ajout de ResourceHandler
@EnableWebMvcAjout IntercepteurConfiguration de ViewController Ajout de ResourceHandlerNe permet pas une configuration fine
@EnableWebMvc Ajout Intercepteur Configuration de ViewController  Ajout de ResourceHandler Ne permet pas une configuration...
@Enable*
@Enable*EnableAsyncEnableAspectJAutoProxyEnableSpringConfiguredEnableLoadTimeWeavingEnableTransactionManagement
Testing 2.5 1   @RunWith(SpringJUnit4ClassRunner.class) 2   @ContextConfiguration("test-config.xml") 3   public class MyTe...
Testing 3.1 1   @RunWith(SpringJUnit4ClassRunner.class) 2   @ContextConfiguration(classes = TestConfig.class) 3   @ActiveP...
Servlet 3.0 1 public class WebInitializer implements WebApplicationInitializer { 2 3     @Override 4     public void onSta...
DEMO
Spring 3.1 bis
@Profile 1 @Configuration 2 public class ApplicationConfig { 3 4     @Bean 5     DataSource dataSource(){ 6         JndiOb...
<Profile />1 <beans profile="dev">2     <jdbc:embedded-database id="dataSource">3          <jdbc:script location="schema.s...
Activation1 <webapp>2     <context-param>3          <param-name>spring.profiles.active</param-name>4          <param-value...
Activation1 <servlet>2     <servlet-name>dispatcher</servlet-name>3     <servlet-class>osf.web.servlet.DispatcherServlet</...
Spring 3.1, c’est aussiSupport Hibernate 4Namespace c:JPA sans Persistence.xml...
Spring 3.2
Spring 3.2Spring 3.2 RC1 - Release début Novembre Principalement des améliorations de l’existant Support des contrôleurs a...
Spring est mort ?
Spring en 2003     Framework
Spring en 2012                  Batch SpringData                                       SpringMobile                       ...
Conclusions
Questions ?
Prochain SlideShare
Chargement dans…5
×

Spring&amp;lt;xml&gt; est mort, Vive Spring NoXML @ ParisJUG

748 vues

Publié le

Publié dans : Technologie
  • DOWNLOAD FULL BOOKS, INTO AVAILABLE FORMAT ......................................................................................................................... ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y3nhqquc } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y3nhqquc } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y3nhqquc } ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y3nhqquc } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y3nhqquc } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y3nhqquc } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Répondre 
    Voulez-vous vraiment ?  Oui  Non
    Votre message apparaîtra ici

Spring&amp;lt;xml&gt; est mort, Vive Spring NoXML @ ParisJUG

  1. 1. Spring<XML> est mort Vive Spring NoXML par Gildas Cuisinier @gcuisinier
  2. 2. whois(@gcuisinier)Maître Artisan Développeur, Sfeir Benelux Initiateur de la section Spring de @Developpez.com Relecteur de plusieurs livres sur SpringEvangéliste Spring ( JUGs, Devoxx France )
  3. 3. Spring ?
  4. 4. Spring ? es nc da en AO ép P ed nd tio ecInj Abstraction de services
  5. 5. Retour en 2004
  6. 6. Retour en 2004
  7. 7. Spring 1.0
  8. 8. Spring 1.01 <bean id="monBean" class="be.hikage.service.MyService">2 <property name="version" value="maVersion"/>3 </bean>45 <bean />
  9. 9. Spring 1.0 1 <bean id="monBean" class="be.hikage.service.MyService"> 2 <property name="version" value="maVersion"/> 3 </bean> 4 5 <bean /> 6 <bean /> 7 <bean /> 8 <bean /> 9 <bean />10 <bean />
  10. 10. Spring 1.2
  11. 11. Spring 1.21 <bean id="monBean" class="be.hikage.service.MyService">2 <property name="version" value="maVersion"/>3 </bean>4
  12. 12. Spring 1.21 <bean id="monBean" class="be.hikage.service.MyService">2 <property name="version" value="maVersion"/>3 </bean>45 <import resource="service-layer.xml"/>6 <import resource="dao-layer.xml"/>7 <import resource="disp-layer.xml"/>
  13. 13. Spring 1.2
  14. 14. "> Proxy xy" lter Chain inPro il.Fi Sourc e "> filt erCha curi ty.ut ition an id =" g.ace gise Defin1 <be s="or ation clas lter Invoc e="fi PARIS ON2 ert y nam E_COM <prop ASE_B EFOR 3 lue> OWERC <v a _TO_L T_URL NT 4 C ONVER CHE_A P E_APA RN_TY 5 PATTE er nFilt n = nteg ratio 6 /logi textI essi onCon 7 httpS lter rm= ionFi in.fo egrat 8 /log xtInt Conte e ssion 9 httpS ter = onFil ts/** Inte grati 10 /asse ntext ess ionCo eck= 11 httpS ty_ch er, ecuri nFilt eg i_s nteg ratio 12 /j_ac textI er onCon gFilt essi Proc essin 13 httpS ation uth entic 14 formA er, nFilt nteg ratio 15 /**= textI essi onCon lter 16 httpS ionFi ra nslat tionT 17 excep ue> 18 < /v a l r"> 19 roper ty> lter" Filte </p ionFi tegr ation egrat extIn 20 n> onte xtInt ssio nCont </bea sionC ttpSe 1 tpSes y...H 2 id="h t curit <bean egise 22 ="o rg.ac class Point "> 23 t" lter Entry </bea n> yPoin ingFi 24 atio nEntr onPr ocess entic icati Logi nAuth ..Au thent "/> 25 "form rity. login n id= isecu ue="/ <bea .aceg mUrl" val 26 ="org inFor e"/> class og "fals me="l alue= 27 erty na ps" v <prop ceHtt name ="for 28 erty <prop 29 n> </bea 30
  15. 15. Spring 2.0 1 <security:http auto-config="true"> 2 <security:intercept-url pattern="/login*" 3 access="IS_AUTHENTICATED_ANONYMOUSLY"/> 4 <security:intercept-url pattern="/logoutSuccess*" 5 access="IS_AUTHENTICATED_ANONYMOUSLY"/> 6 <security:intercept-url pattern="/css/main.css" 7 access="IS_AUTHENTICATED_ANONYMOUSLY"/> 8 <security:intercept-url pattern="/**" 9 access="ROLE_USER"/>1011 <security:form-login login-page="/login.html"12 login-processing-url="/loginProcess"13 default-target-url="/index.jsp"14 <security:logout logout-url="/logout"15 logout-success-url="/logoutSuccess.html"/>16 </security:http>
  16. 16. Spring 2.5 1 @Controller 2 public class MyController { 3 4 private MyService myService; 5 6 @Autowired 7 public void setMyService(MyService myService) { 8 this.myService = myService; 9 }1011 }
  17. 17. Spring 2.5 1 @Controller 2 public class MyController { 3 4 private MyService myService; 5 6 @Autowired 7 public void setMyService(MyService myService) { 8 this.myService = myService; 9 }1011 }1 <context:component-scan base-package="be.hikage" />
  18. 18. Spring 3.01 @Configuration2 public class ApplicationConfig {34 @Bean5 public MyService myService() {6 return new MyService();7 }89 }
  19. 19. Spring 3.01 @Configuration // <beans>2 public class ApplicationConfig {34 @Bean //<bean id="myService>5 public MyService myService() {6 return new MyService();7 }89 }
  20. 20. Spring 3.0 1 @Configuration // <beans> 2 public class ApplicationConfig { 3 4 @Bean //<bean id="myService> 5 public MyService myService() { 6 return new MyService(); 7 } 8 9 }1 ApplicationContext factory =2 new AnnotationConfigApplicationContext(ApplicationConfig.class)
  21. 21. Spring 3.01 @Component2 public class MyTask {34 @Scheduled(cron="* * * * *")5 public void execute() {6 // code7 }89 }
  22. 22. Spring 3.01 @Component2 public class MyTask {34 @Scheduled(cron="* * * * *")5 public void execute() {6 // code7 }89 }1 <context:component-scan base-package="be.hikage" />2 <task:annotation-driven scheduler="myScheduler" .. />
  23. 23. Spring 3.01 @Component2 public class MyTask {34 @Scheduled(cron="* * * * *")5 public void execute() {6 // code7 }89 }1 <context:component-scan base-package="be.hikage" />2 <task:annotation-driven scheduler="myScheduler" .. />
  24. 24. Spring 3.1@nnotations ++
  25. 25. @ComponentScan1 <context:component-scan base-package="be.hikage"/>1 @Configuration2 @ComponentScan("be.hikage")3 public class ApplicationConfig
  26. 26. @ComponentScan1 <context:component-scan base-package="be.hikage"/>1 @Configuration2 @ComponentScan("be.hikage")3 public class ApplicationConfig
  27. 27. @EnableScheduling1 public class MaTache {23 @Scheduled(fixedRate = 1000)4 public void execute() {5 System.out.println("Maman, je parle au ParisJUG");6 }7 }
  28. 28. @EnableScheduling1 <task:annotation-driven />
  29. 29. @EnableScheduling1 <task:annotation-driven />1 @Configuration2 @EnableScheduling3 public class ApplicationConfig {4 }
  30. 30. @EnableScheduling1 @Target(ElementType.TYPE)2 @Retention(RetentionPolicy.RUNTIME)3 @Import(SchedulingConfiguration.class)4 @Documented5 public @interface EnableScheduling {67 }
  31. 31. @EnableScheduling 1 @Configuration 2 public class SchedulingConfiguration { 3 4 @Bean(name=AnnotationConfigUtils.SCHEDULED_ANNOTATION_PROCESSOR_BEAN_NAME) 5 @Role(BeanDefinition.ROLE_INFRASTRUCTURE) 6 public ScheduledAnnotationBeanPostProcessor scheduledAnnotationProcessor() { 7 return new ScheduledAnnotationBeanPostProcessor(); 8 } 910 }
  32. 32. @EnableCaching 1 @Service 2 public class CalculateurPrix { 3 4 @Cacheable(value = "price") 5 public Double calculePrix(String reference){ 6 // calcul long et complexe 7 return 42L; 8 } 91011121314 }
  33. 33. @EnableCaching 1 @Service 2 public class CalculateurPrix { 3 4 @Cacheable(value = "price") 5 public Double calculePrix(String reference){ 6 // calcul long et complexe 7 return 42L; 8 } 910 @CacheEvict(value = "price",allEntries = true)11 public void setRistourne(Float indice){1213 }14 }
  34. 34. @EnableCaching1 <caching:annotation-driven />23 <bean class="org.springframework.cache .concurrent.ConcurrentMapCacheManager"/>4
  35. 35. @EnableCaching 1 @Configuration 2 @EnableCaching 3 public class ApplicationConfig { 4 5 @Bean 6 CacheManager cacheManager(){ 7 return 8 new ConcurrentMapCacheManager(); 9 }10 }
  36. 36. Abstraction de CacheOut of the Box ConcurrentHashMap EhCacheGemFireJCache (Spring 3.2/3.3)
  37. 37. @EnableWebMvc1 <mvc:annotation-driven />
  38. 38. @EnableWebMvc1 <mvc:annotation-driven />1 @Configuration2 @EnableWebMvc3 public class WebConfig {4 }
  39. 39. @EnableWebMvc1 <mvc:annotation-driven/>2 <mvc:interceptors>3 <bean class="osf..LocaleChangeInterceptor"/>4 </mvc:interceptors>
  40. 40. @EnableWebMvc + WebMvcConfigurerAdapter 1 @Configuration 2 @EnableWebMvc 3 public class WebConfig 4 extends WebMvcConfigurerAdapter{ 5 6 @Override 7 public void addInterceptors(InterceptorRegistry registry) { 8 registry.addInterceptor(new LocaleChangeInterceptor()); 9 }10 }
  41. 41. @EnableWebMvc
  42. 42. @EnableWebMvcAjout Intercepteur
  43. 43. @EnableWebMvcAjout IntercepteurConfiguration de ViewController
  44. 44. @EnableWebMvcAjout IntercepteurConfiguration de ViewController Ajout de ResourceHandler
  45. 45. @EnableWebMvcAjout IntercepteurConfiguration de ViewController Ajout de ResourceHandler
  46. 46. @EnableWebMvcAjout IntercepteurConfiguration de ViewController Ajout de ResourceHandlerNe permet pas une configuration fine
  47. 47. @EnableWebMvc Ajout Intercepteur Configuration de ViewController Ajout de ResourceHandler Ne permet pas une configuration fine➡ @EnableWebMvc et étendre WebMvcConfigurationSupport
  48. 48. @Enable*
  49. 49. @Enable*EnableAsyncEnableAspectJAutoProxyEnableSpringConfiguredEnableLoadTimeWeavingEnableTransactionManagement
  50. 50. Testing 2.5 1 @RunWith(SpringJUnit4ClassRunner.class) 2 @ContextConfiguration("test-config.xml") 3 public class MyTest { 4 @Autowired 5 MyService service; 6 7 @Test 8 public void myTest(){ 9 }10 }
  51. 51. Testing 3.1 1 @RunWith(SpringJUnit4ClassRunner.class) 2 @ContextConfiguration(classes = TestConfig.class) 3 @ActiveProfiles("test") 4 public class MyTest { 5 @Autowired 6 MyService service; 7 8 @Test 9 public void myTest(){10 }11 }
  52. 52. Servlet 3.0 1 public class WebInitializer implements WebApplicationInitializer { 2 3 @Override 4 public void onStartup(ServletContext servletContext) throws ServletException { 5 6 AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext(); 7 context.register(WebMvcConfig.class); 8 9 ServletRegistration.Dynamic servletConfig = servletContext.addServlet("dispatcher", new DispatcherServlet(context));10 servletConfig.setLoadOnStartup(1);11 servletConfig.addMapping("*.do");12
  53. 53. DEMO
  54. 54. Spring 3.1 bis
  55. 55. @Profile 1 @Configuration 2 public class ApplicationConfig { 3 4 @Bean 5 DataSource dataSource(){ 6 JndiObjectFactoryBean result = new JndiObjectFactoryBean(); 7 result.setJndiName("jdbc/dataSource"); 8 return (DataSource) result.getObject(); 9 }10 }
  56. 56. <Profile />1 <beans profile="dev">2 <jdbc:embedded-database id="dataSource">3 <jdbc:script location="schema.sql"/>4 <jdbc:script location="test-data.sql"/>5 </jdbc:embedded-database>6 </beans>
  57. 57. Activation1 <webapp>2 <context-param>3 <param-name>spring.profiles.active</param-name>4 <param-value>dev</param-value>5 </context-param>6 </webapp>
  58. 58. Activation1 <servlet>2 <servlet-name>dispatcher</servlet-name>3 <servlet-class>osf.web.servlet.DispatcherServlet</servlet-class>4 <init-param>5 <param-name>spring.profiles.active</param-name>6 <param-value>dev</param-value>7 </init-param>8 </servlet>
  59. 59. Spring 3.1, c’est aussiSupport Hibernate 4Namespace c:JPA sans Persistence.xml...
  60. 60. Spring 3.2
  61. 61. Spring 3.2Spring 3.2 RC1 - Release début Novembre Principalement des améliorations de l’existant Support des contrôleurs asynchrones dans WebMVC Amélioration du testing (REST, MVC)Release prévue pour le 12/12/12 ;-)Spring 3.3 JEE 7 : JPA 2.1, Bean Validation 1.1, JMS 2
  62. 62. Spring est mort ?
  63. 63. Spring en 2003 Framework
  64. 64. Spring en 2012 Batch SpringData SpringMobile Framework Integration Security FlexSpringAndroid SpringSocial
  65. 65. Conclusions
  66. 66. Questions ?

×