O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.

Spring ME

1.507 visualizações

Publicada em

  • A professional Paper writing services can alleviate your stress in writing a successful paper and take the pressure off you to hand it in on time. Check out, please ⇒ www.HelpWriting.net ⇐
    Tem certeza que deseja  Sim  Não
    Insira sua mensagem aqui

Spring ME

  1. 1. Spring ME Unleashing Spring to the Rest of the Platorm J-Spring 2009 Wilfred Springer
  2. 2. Java is doing AWESOME! 2 Source: Tiobe Programming Community Index March
  3. 3. Spring is doing GREAT! = + 3 Source: Evans Data, 2008
  4. 4. But that's like... a freaking big number 4
  5. 5. … or is it? SAN MATEO, Calif.—November 19, 2008 – SpringSource, a leading provider of infrastructure software and the company behind Spring, the de facto standard in enterprise Java, today announced that results from an extensive Evans Data research study reveal large scale adoption and penetration of Spring as a means of increasing developer productivity and combating complexity in today’s enterprise application infrastructure market. 5
  6. 6. Java Nodes in the Cloud 3 Billion Java-Enabled Cards in 2007 ● 1.8 Billion Java-Enabled Phones in 2007 ● 7 Million Java Set-top Boxes ● 1 Million GWT downloads in 2007 ● 6
  7. 7. Not all men are equal Versus 7
  8. 8. We the people “We hold these truths to be self-evident, that all men are created equal, that they are endowed by their Creator with certain unalienable Rights, that among these are Life, Liberty, and the Pursuit of Happiness.” 8
  9. 9. We the people “We hold these truths to be self-evident, that all men... Java Developers are enttled to get their porton of Spring goodness.” Not just Java EE developers Not just Java SE developers But also Java ME developers And Java Card developers 9
  10. 10. Why Spring? All Spring's goodness summarized in famous last words 10
  11. 11. IoC Container “Trust us, we know what we're doing.” “Don't call us, we call you.” 11
  12. 12. Sanitized API “Any problem in computer science can be solved with another layer of indirecton.” – David Wheeler
  13. 13. AOP “Once you have a hammer, everything else is a nail.”
  14. 14. So why not use Spring itself? Platorm Limitatons ● Limited Java Runtme capabilites ● Limitatons imposed by deployment ● Limited computatonal resources Limitatons on heap – Limitatons on applicaton size – Limitatons on performance –
  15. 15. Java Runtime Limitations ct ) e( refle ) ... anc g. e( s t n tring am In a.la .S i st rN e w a v il.L ng o s.f ss.n er j a.la r ut a. as la a h v v Ot Cl ch ja ja C GWT n n n y y y Java ME y y n y y n Java Card n n n n n n BeanFactory#getBean(String name)? BeanFactory#getBean(char[] name)?
  16. 16. Deployment Limitations (1) <bean id=”movie1” class=”sample.Movie”> <property name=”title” value=”Into the Wild”/> 1 </bean> OBFUSCATION package a.b; package com.mgm; public class a { public class Movie { void a(String ...); void setTitle(String title); } } 2 3 <bean id=”movie1” class=”a.b.a”> <property name=”a” value=”Into the Wild”/> </bean> 4
  17. 17. Deployment Limitations (2) GWT → JavaScript ● Java Card → CAP fles ●
  18. 18. Computational Resources (1) Heap: ● Java SE ● Max heap approx. 1.5 GB – Java ME ● Lower bound max. heap: 140 KB – Upper bound max. heap: 128 MB – Between factor 11 and 11,714 diference – Java Card ● 16 K RAM –
  19. 19. Computational Resources (2) Applicaton size: ● Java ME: Upperbounds between 64 KB and 28 MB ● Spring Core 267KB Spring Beans 467KB Spring Context 455KB Total 1189KB
  20. 20. Throughput Nokia E71: ● 369 MHz ARM 11 CPU – Gameboy Advance ● 16 MHz ARM 7 CPU – C-Ray Raytracing Benchmark 296108 s – Dell PowerEdge M710 ● 2.4 GHz Xeon Quad Core CPU – C-Ray Raytracing Benchmark 201 s –
  21. 21. Introducing Spring ME's IoC Do most of the hard work at build time 21
  22. 22. Assume this object model 22
  23. 23. And you want to create this 23
  24. 24. The Spring (ME) configuration <beans xmlns=”…”> <bean id=”movieFinder” class=”….InMemoryMovieFinder”> <property name=”movies”> <list> <bean class=”….Movie”> <property name=”title” value=”Bye Bye Blue Bird”/> <property name=”director” value=”Søren Kragh-Jacobsen”/> <property name=”year” value=”1999”/> </bean> … </list> </property> </bean> </beans> 24
  25. 25. … And with the Maven plugin <project> <build> <plugins> <plugin> <groupId>me.springframework</groupId> <artifactId>spring-me-maven-plugin</artifactId> <version>1.0-SNAPSHOT</version> <executions> <execution> <goals> <goal>generate</goal> </goals> <configuration> <contextFile>....context.xml</contextFile> <className>com.mgm.BeanFactory</className> </configuration> </execution> </executions> 25
  26. 26. You get this BeanFactory public class BeanFactory { public Object getBean(String name) { if (“movieFinder”.equals(name)) { return getMovieFinder(); } } private final Object getMovieFinder() { … } … } 26
  27. 27. DEMO Spring ME on Java SE ● Spring ME on Java ME ● Spring ME on GWT ● 27
  28. 28. Spring ME Compile tme validaton ● “Is 10e2 a valid int representaton?” – “Is an instance of Boeing747 assignable to a – property of type Airplane?” Minimal or no runtme dependencies ● Superfast (but no benchmarks to verify this) ● Small (1K?) ●
  29. 29. Under the hood 29
  30. 30. Spring ME Meta Model Meta Model independent of Spring ● Typically Spring XML confguraton is used ● Meta Model supports other sources ● Spring XML Spring ME Spring ME Configuration BeanFactory Meta Model 30
  31. 31. Other sources? @Autowired @ProvidedBy @PostConstruct @Inject @PostDestroy @ImplementedBy Annotations Spring ME Spring ME BeanFactory Meta Model Spring XML Configuration 31
  32. 32. Spring ME's Meta Model 32
  33. 33. Meta Model Instantiated 33
  34. 34. If not Spring ME, then what? GWT ● Java Card ● GWToolbox – None – Rocket GWT – (Spring ME?) – GIN – Java ME ● Spring ME – Signal – Suco – Israfl IoC – Fall ME – Spring ME –
  35. 35. Inversion of Control Galore x ion rs nta at y n ur olde t S tio n n ig jec ctio s o n od rati onf ceh plia od in h h et od met figu on c pla om s* tor inje s es g n E ton yp m th y io truc rty me e irin n ati rty C y o t T va M gle otot zy ger ctor t me stro L c not ope ring as llec ns ope na typ tow i n i W G Ja Si Pr La Ea Fa In De XM An Pr Sp Al Co Co Pr By By Au Rocket GWT y n y y y y y y y y n y n n all y y y n ? Spring ME y y y y y y y y y y n n y n l/m y y y y ... Israfil IoC n y y n n n n n n n n n n n ... y n n y y Fall ME n y y n n n n n n n n n n n ... y n n n n GWToolbox y n y y y y ? y y n y y n n all n y n y y Signal n n y y n n ? n n n y n y n all n y y ? ? 35
  36. 36. The Rest: Sanitized API Java ME needs a lot more sanity ● J2ME Polish is your friend – Java Card is probably too limited to use ● wrapper API GWT is already addressed by a lot of ● frameworks 36
  37. 37. The Rest: AOP? What about it? ● Using the metadata, proxies could be ● constructed at build tme The factory could construct these proxies ● instead of the actual objects 37
  38. 38. Current status 'Request' scope ● 'Session' scope ● 'Global session' scope ● BeanFactoryAware, but ... ● BeanPostProcessor (without refecton?) ● BeanFactoryPostProcessor, but ... ● FactoryBean, but ... ● 38
  39. 39. If there's only one thing “ME” as in “supportng Java ME” ● “ME” as in “a microscopic small version of ● Spring” Useful for Java ME ● Useful for GWT ● Useful for Java SE ● Potentally useful for Java Card and Java EE ● 39
  40. 40. Roadmap Version 1.0 (J109 release) end of May 2009 ● Integraton with J2ME Polish ● BOF-4470, June 4, JavaOne ● htp://springframework.me/ ● spring-me@googlegroups.com ● 40