Spring 4 en spring data

1,264 views

Published on

What's new in Spring 4?
Plus an introduction to Spring Data Modules

Published in: Software, Technology, Education
  • Be the first to comment

Spring 4 en spring data

  1. 1. Spring Framework 4 and Spring Data WHAT’S NEW
  2. 2. Agenda Intro to Spring IoC ◦ Spring 3.x highlights What’s new in Spring Core 4 ◦ @Conditional ◦ Spring Boot ◦ Autowiring voor Generic types Spring Data ◦ SQL and NoSQL ◦ Generic Query Framework
  3. 3. Intro to Spring Framework Inversion of Control Pattern ◦ GoF °1995: Strategy Pattern ◦ Program using interfaces ◦ Clients are not tied to implementations ◦ Dependency Injection ◦ Central Application Context to wire implementations together ◦ Hollywood Principle: Don’t call us, we’ll call you ◦ Allows better testing Spring Framework ◦ Rod Johnson book on J2EE: Spring 0.1 °2002 ◦ Application context using XML descriptors ◦ ‘Faster, Beter, Lighter Java’: O’Reilly °2004 ◦ Spring and Hibernate as alternative to J2EE/EJB 1/EJB 2
  4. 4. Spring Framework Modules Spring includes various abstraction modules ◦ Database abstraction ◦ Exception Handling ◦ JDBC Abstraction ◦ Hibernate/JPA Session Management (deprecated) ◦ Remoting ◦ Data serialization abstraction ◦ Exception Handling ◦ Messaging ◦ JMS API Abstraction ◦ Data serialization abstraction ◦ Management ◦ JMX API Abstraction Spring Framework also has Spring MVC and Spring WebFlow
  5. 5. Spring 3.x Highlights Spring 2.5 ◦ @Autowired and @Component classpath scanning ◦ Less XML Spring 3.0 ◦ JavaConfig iso XML Config files ◦ Even less XML Spring 3.1 ◦ Bean Profiles ◦ TestContext support Spring 3.2 ◦ Spring MVC improvements ◦ Spring MVC REST
  6. 6. Spring Framework 4 No big changes ◦ Mostly everything is backwards compatible ◦ Except @Autowired with Generics ◦ Some deprecated methods are finally removed ◦ E.g: ibatis ORM support ◦ Spring MVC base classes before annotation support Some new features ◦ @Conditional ◦ Spring Boot ◦ Support for Groovy iso XML Some modules major upgrade ◦ Spring MVC with WebSocket support
  7. 7. WebSockets in Spring 4 DEMO: https://github.com/rstoyanchev/spring-websocket-portfolio
  8. 8. Spring Data Data Persistence abstraction ◦ Supports both SQL and NoSQL ◦ JPA/JDBC ◦ MongoDB/Hadoop ◦ Repository abstraction ◦ Save/load/delete ◦ Paging and sorting ◦ Entity annotations are stil implementation specific ◦ Query Language abstraction ◦ QueryDSL
  9. 9. Spring Data Queries Declare methods in your repository interface ◦ findByXxxx ◦ Spring AOP will generate Implementation Or: use @Query annotation
  10. 10. Spring Data DEMO
  11. 11. Questions

×