Spring
Spring?
• Inversion of control




• Dependency Injection
• DEPENDENCY INJECTION
  Atunci cand :
     • public Car buildCar() {
            Car car = new Car();
            Engine ...
• INVERSION OF CONTROL
  Atunci cand :
     • public Car buildCar() {
            Car car = new Car();
            Engine ...
• Cool stuff:

  – Roo - roo generate controller ;)
  – Easy configuration with xml;
  – Templates for Hibernate DAO;
  – ...
Container Configuration
•   Dependency Injection


     <bean id=“myCar" class=“gm.Ford">
                 <property name=...
Fast configuration
• Autowiring
<bean id="sequenceGenerator“ class="SequenceGenerator” autowire="byType">
</bean>

<bean i...
…bean creation
• Prototype (instance/request)

• Singleton (instance/IOC container)

• Session/Request (instance/session/r...
Aspects
• Advice
     • Ex: logging before and after


• Pointcut
     • Ex: account.putMoney()


• Aspect
  – Advice + Po...
Externalized configuration
• @Controller

• @RequestMapping

• @Aspect

• @Autowired
QA?




      http://alexsisu.posterous.com/
          alexandru.sisu@gmail.com
Resources
• http://www.springsource.org/

• http://www.springbyexample.org

• http://www.springsource.org/roo
Upcoming SlideShare
Loading in …5
×

Spring

508 views
474 views

Published on

Alex a ne-a prezentat Spring la Geek Meet #6 Timişoara. Spring este o platformă de dezvoltare croită pentru proiecte Java, iar despre avantajele ce le oferă puteţi afla mai multe din prezentare, asta dacă nu aţi ajuns la Geek Meet :)

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
508
On SlideShare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
7
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Spring

  1. 1. Spring
  2. 2. Spring? • Inversion of control • Dependency Injection
  3. 3. • DEPENDENCY INJECTION Atunci cand : • public Car buildCar() { Car car = new Car(); Engine engine = new Engine(); car.setEngine(engine); return car; } - Scriem cod ca asta si vrem sa-i impresionam pe altii;
  4. 4. • INVERSION OF CONTROL Atunci cand : • public Car buildCar() { Car car = new Car(); Engine engine = new Engine(); car.setEngine(engine); return car; } … si chestia de mai sus, o face Springu’
  5. 5. • Cool stuff: – Roo - roo generate controller ;) – Easy configuration with xml; – Templates for Hibernate DAO; – AOP features: aspects, advices, pointcuts ☺ – Easy to configure a project with it: – Standard set of libraries; – Many examples; – Good documentation and many books; – Its so full of patterns! ☺
  6. 6. Container Configuration • Dependency Injection <bean id=“myCar" class=“gm.Ford"> <property name=“engine" ref=“renaultEngine" /> </bean> <bean id=“renaultEngine" class=“renault.engines.RenaultEngine“/> • Inversion of control myCar = context.getBean(“myCar”); • Service locator Is what spring is using for retrieving the objects from its container;
  7. 7. Fast configuration • Autowiring <bean id="sequenceGenerator“ class="SequenceGenerator” autowire="byType"> </bean> <bean id="datePrefixGenerator” class="DatePrefixGenerator"> class SequenceGenerator { public SequenceGenerator(DatePrefixGenerator generator) {…} } • Scan package <context:component-scan base-package=“org.mypackage"/>
  8. 8. …bean creation • Prototype (instance/request) • Singleton (instance/IOC container) • Session/Request (instance/session/request) • Proxying: • Necessary for AOP (see proxy pattern)
  9. 9. Aspects • Advice • Ex: logging before and after • Pointcut • Ex: account.putMoney() • Aspect – Advice + Pointcut: Log(“[Enter]putMoney”) Account.putMoney(); Log(“[Exit]putMoney”)
  10. 10. Externalized configuration • @Controller • @RequestMapping • @Aspect • @Autowired
  11. 11. QA? http://alexsisu.posterous.com/ alexandru.sisu@gmail.com
  12. 12. Resources • http://www.springsource.org/ • http://www.springbyexample.org • http://www.springsource.org/roo

×