Professional Documents
Culture Documents
J-Spring 2009
Wilfred Springer
Java is doing AWESOME!
2
Source: Tiobe Programming Community Index March
Spring is doing GREAT!
=
+
3
Source: Evans Data, 2008
But that's like... a freaking big
number
4
… or is it?
5
Java Nodes in the Cloud
6
Not all men are equal
Versus
7
We the people
8
We the people
9
Why Spring?
10
IoC Container
11
Sanitized API
Platorm Limitatons
● Limited Java Runtme capabilites
– Limitatons on heap
– Limitatons on applicaton size
– Limitatons on performance
Java Runtime Limitations
c t
( ) f l e
) e
.( .. anc g.re g
e s t n trin
a m In . l a t
N ew a . S i s
o r a v n g i l. L
s .f s.n r j
. l a . u t
a s a s h e a a r a
v v
Cl Cl Ot ja ch ja
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)?
Deployment Limitations (1)
OBFUSCATION
package a.b;
package com.mgm;
public class a {
public class Movie {
void a(String ...);
void setTitle(String title);
}
}
2 3
● 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
Computational Resources (2)
● Applicaton size:
● Java ME: Upperbounds between 64 KB and 28 MB
● 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
Introducing Spring ME's IoC
Do most of the
hard work at
build time
21
Assume this object model
22
And you want to create this
23
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
… 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
You get this BeanFactory
26
DEMO
● Spring ME on Java SE
● Spring ME on Java ME
● Spring ME on GWT
27
Spring ME
29
Spring ME Meta Model
● Meta Model independent of Spring
● Typically Spring XML confguraton is used
● Meta Model supports other sources
30
Other sources?
@Autowired @ProvidedBy
@PostConstruct @Inject
@PostDestroy @ImplementedBy
Annotations
Spring ME Spring ME
Meta Model BeanFactory
Spring XML
Configuration 31
Spring ME's Meta Model
32
Meta Model Instantiated
33
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
Inversion of Control Galore
x
it on rs nta
u ra lde Sy ti on
n t
o ds od atio nfig eho lian jec tion
n
s s e th d eth gur n co lac mp
i s* or i njec g
E ton ype m h o m nf tio y p Co o n ct y i e i n
y t y o a r t i t
t ru r m e i r
T va M gle otot zy ger ctor t me stro L c not ope ring as llec nst ope na typ tow
W n i i
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
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
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
Current status
● 'Request' scope
● 'Session' scope
● 'Global session' scope
● BeanFactoryAware, but ...
● BeanPostProcessor (without refecton?)
● BeanFactoryPostProcessor, but ...
● FactoryBean, but ...
38
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
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