Spring Intro

2,515 views
2,470 views

Published on

A small and simple introduction to Spring Framework, with a pointer to SCA

Published in: Business, Technology

Spring Intro

  1. 1. Introduction to Spring [email_address]
  2. 2. What is Spring <ul><li>Java/JEE Application Framework </li></ul><ul><li>Main target: JEE Web Applications </li></ul><ul><li>Apache 2 License </li></ul><ul><li>Hosted on SourceForge </li></ul><ul><li>Business objects as POJO </li></ul>
  3. 3. Integration <ul><li>O/R Mapping tools </li></ul><ul><ul><li>JDBC, Hibernate, JDO, iBatis, etc </li></ul></ul><ul><li>Web Frameworks </li></ul><ul><ul><li>Spring-WebMVC, Struts, Tapestry, etc </li></ul></ul><ul><li>Remoting Protocols </li></ul><ul><ul><li>RMI, JAX-RPC, HTTP, Hessian, Burlap, </li></ul></ul>
  4. 4. Hollywood Principle <ul><li>“ Don't call me, I'll call you” </li></ul><ul><li>Inversion of Control </li></ul><ul><ul><li>spring-ioc as core module </li></ul></ul><ul><ul><li>objects/components are configured from the outside </li></ul></ul><ul><li>Dependency Injection </li></ul><ul><ul><li>setter based (JavaBeans) </li></ul></ul><ul><ul><li>constructor based </li></ul></ul><ul><ul><li>service lookup (jndi, ...) </li></ul></ul>
  5. 5. core concepts <ul><li>Composition </li></ul><ul><ul><li>a pojo is flat by nature </li></ul></ul><ul><li>Lifecycle management </li></ul><ul><ul><li>BeanFactory </li></ul></ul><ul><li>Binding management </li></ul><ul><ul><li>(auto) wiring </li></ul></ul><ul><ul><ul><li>by name, by type, ... </li></ul></ul></ul>
  6. 6. hello world <ul><li><bean id=”client” class=”Client”> </li></ul><ul><li><property name=”server”> </li></ul><ul><li><ref bean=”server”/> </li></ul><ul><li></bean> </li></ul><ul><li><bean id=server” class=”Server”/> </li></ul>
  7. 7. another example <ul><li><bean id=”dao” class=”MyDao”> </li></ul><ul><li><property name=”dataSource”> </li></ul><ul><li><ref bean=”dataSource”/> </li></ul><ul><li></bean> </li></ul><ul><li><!--local--> </li></ul><ul><li><bean id=”dataSource class=”BasicDataSource”> </li></ul><ul><ul><li><property name=”driverClassName” value=””/> </li></ul></ul><ul><ul><li><property name=”url” value=”..”/> </li></ul></ul><ul><li></bean> </li></ul><ul><li><bean id=”remoteDataSource” class=”org.springframework.jndi.JndiObjectFactoryBean”> </li></ul><ul><ul><li><property name=”...” > </li></ul></ul><ul><li></bean> </li></ul>To change datasource, change the value referenced in the dao component
  8. 8. Spring + AOP <ul><li>Spring v 1.x : proxies around pojos </li></ul><ul><li>Spring 2.x : proxies + aspectj </li></ul><ul><ul><li>load-time weaving </li></ul></ul>
  9. 9. Spring + SCA

×