Developing Java Applications in Agile way using SpringSource Tool Suite (STS) 2.3.2, Maven, Spring tc server<br />Presente...
Agenda <br />2/19<br />Spring Framework (Introduction)<br />Spring 3.0 – What’s new ? (if needed) <br />SpringSource Tool ...
No Spring Allergy !!!<br />3/19<br />
Spring Framework<br />Open source framework for Java development ( Spring Core, Spring MVC, Spring JDBC, Web Services etc....
Spring 3.0 – What’s new ?	<br />Java 5+ support<br />Spring Expression Language<br />REST Support<br />Portlet 2.0<br />De...
Spring 3.0 – What’s new ? <br /><ul><li>Java 5+ support
Generics – Beanfactory returns typed bean instances</li></ul>T getBean(String name, Class<T> type)<br />Map<String, T> get...
Configuration 3 types
XML Based (applicationContext.xml)
Annotations in the beans (@ Components)
Configuration classes (Spring Java Config Project)</li></ul>6/19<br />
Spring 3.0 – What’s new ? <br /><ul><li>Spring Java Config Project
Java configuration class instead of XML Configuration
Everything in Java – stronger type checking
Dependencies confined to one place. No additional annotations inside the app code
Every method returns a spring managed bean</li></ul>@Bean @Primary @Lazy<br />public DemoServicedemoService(){<br />DemoSe...
Spring 3.0 – What’s new ? <br /><ul><li>Meta Annotations
Making custom annotations (your own stereotypes) more powerful
App code doesn’t depend on Spring Annotations instead uses Java Annotations</li></ul>@Service@Scope ("request")<br />@Tran...
Upcoming SlideShare
Loading in …5
×

Developing Agile Java Applications using Spring tools

6,003 views

Published on

Developing Agile Java Applications using Spring tools

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

No Downloads
Views
Total views
6,003
On SlideShare
0
From Embeds
0
Number of Embeds
45
Actions
Shares
0
Downloads
123
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

Developing Agile Java Applications using Spring tools

  1. 1. Developing Java Applications in Agile way using SpringSource Tool Suite (STS) 2.3.2, Maven, Spring tc server<br />Presented by : Sathish Chittibabu<br /> Date : May 11th2010<br /> Event : Solstice Consultants Round table discussion<br />
  2. 2. Agenda <br />2/19<br />Spring Framework (Introduction)<br />Spring 3.0 – What’s new ? (if needed) <br />SpringSource Tool Suite (STS) 2.3.2<br />Spring tcServer<br />Maven<br />Quick example <br />So what’s Agile here ? <br />
  3. 3. No Spring Allergy !!!<br />3/19<br />
  4. 4. Spring Framework<br />Open source framework for Java development ( Spring Core, Spring MVC, Spring JDBC, Web Services etc.,)<br />Lightweight, non-invasive container<br />Dependency Injection or Inversion of Controller<br />Assemble complex system from loosely coupled POJOs<br />Reusable business and data access components not tied to J2EE services. <br />Spring managed applications can run in any J2EE environment, as standalone apps, test environments<br />Lean Software Movement<br />4/19<br />
  5. 5. Spring 3.0 – What’s new ? <br />Java 5+ support<br />Spring Expression Language<br />REST Support<br />Portlet 2.0<br />Declarative model validation<br />Early support for Java EE6<br />5/19<br />
  6. 6. Spring 3.0 – What’s new ? <br /><ul><li>Java 5+ support
  7. 7. Generics – Beanfactory returns typed bean instances</li></ul>T getBean(String name, Class<T> type)<br />Map<String, T> getBeansOfType(Class<T>, type)<br /><ul><li>TaskExecutor interface extends from java.util.concurrent.Executor (supports standard callables with Futures)
  8. 8. Configuration 3 types
  9. 9. XML Based (applicationContext.xml)
  10. 10. Annotations in the beans (@ Components)
  11. 11. Configuration classes (Spring Java Config Project)</li></ul>6/19<br />
  12. 12. Spring 3.0 – What’s new ? <br /><ul><li>Spring Java Config Project
  13. 13. Java configuration class instead of XML Configuration
  14. 14. Everything in Java – stronger type checking
  15. 15. Dependencies confined to one place. No additional annotations inside the app code
  16. 16. Every method returns a spring managed bean</li></ul>@Bean @Primary @Lazy<br />public DemoServicedemoService(){<br />DemoServiceImpl service = new DemoServiceImpl();<br />service.setDataSource(…);<br /> return service;<br />}<br />7/19<br />
  17. 17. Spring 3.0 – What’s new ? <br /><ul><li>Meta Annotations
  18. 18. Making custom annotations (your own stereotypes) more powerful
  19. 19. App code doesn’t depend on Spring Annotations instead uses Java Annotations</li></ul>@Service@Scope ("request")<br />@Transactional(rollbackFor=Exception.class)<br />@Retention(RetentionPolicy.RUNTIME)<br />public @interface MyService{}<br />@MyService<br />public class DemoService{<br />…<br />}<br />8/19<br />
  20. 20. Spring 3.0 – What’s new ? <br /><ul><li>Spring Expression Language
  21. 21. Similar to managed beans in JSF Expressions
  22. 22. Implicit attributes to be exposed by default (e.g., systemProperties, systemEnviroment)
  23. 23. Implicit web specific attributes are also available (e.g., contextParameters, contextAttributes, request, session)</li></ul>#{systemProperties.databaseName}<br />#{myBean.myProperty}<br />9/19<br />
  24. 24. Spring 3.0 – What’s new ? <br /><ul><li>REST in Spring MVC
  25. 25. @PathVariable introduced – URI templates</li></ul>@Controller@RequestMapping("/hotels/{hotel}") --- optional<br />public class HotelsController{<br />@RequestMapping-- matches /hotels/42<br />public void handleHotel(@PathVariable("hotel") String hotel) {<br /> //...<br />}<br />@RequestMapping("bookings/{booking}") -- matches /hotels/42/bookings/21<br />public void handleBooking(@PathVariable("hotel") String hotel, @PathVariableint booking){<br />// ...<br />}<br />}<br />10/19<br />
  26. 26. Spring 3.0 – What’s new ? <br /><ul><li>New Views added
  27. 27. application/xml – MarshallingView
  28. 28. application/atom+xml – AbstractAtomFeedView
  29. 29. aplication/rss+xml – AbstractRssFeedView
  30. 30. application/json – MappingJacksonJsonView
  31. 31. Parameter Annotations
  32. 32. @RequestHeader, @RequestBody, @ResponseBody, @CookieValue
  33. 33. On the Client Side
  34. 34. RestTemplate (very similar to jdbcTemplate)</li></ul>11/19<br />
  35. 35. Spring 3.0 – What’s new ? <br /><ul><li>Declarative Validation
  36. 36. JSR 303 – “Bean Validation” through annotation
  37. 37. Validation in any layer</li></ul>public class DemoBean {<br /> @NotNull<br /> @Past<br /> private Date someDate;<br /> }<br />12/19<br />
  38. 38. SpringSource Tool Suite (STS) 2.3.2<br />Eclipse-powered Java Integrated development environment (IDE) for building spring-powered enterprise applications<br />Includes tools for all of the latest Enterprise Java and Spring based technologies<br />Supports application targeting local, virtual and cloud based servers<br />In built support for SpringSourcedmServer and SpringSourcetcServer<br />Also available as Eclipse plugin<br />13/19<br />
  39. 39. Spring tcServer<br />Enterprise version of Apache Tomcat<br />Spring and Apache Tomcat – KISSing cousins<br />Lightweight App Server suited for usage in modern virtual or Cloud environments<br />Small foot print, lean approach requires significantly less computing resources<br />Available in Spring edition, Standard edition and Developer edition<br />Developer edition is integrated with STS<br />Spring insight – analytical and advanced diagnostic tool for real time insight into performance (metrics) and behavior of Spring applications<br />14/19<br />
  40. 40. Maven<br />Project Management and comprehension tool to manage <br />Builds, Documentation, Reporting, Dependencies, <br />SCMs, Releases, Distribution<br />Ant is procedural while Maven is Object Oriented<br />Employs standard conventions and practices to accelerate development cycle<br />Concept of Central Repository – share 3rd party and open source libraries across projects (intranet as well internet)<br />Continuous Integration – automated build, release, tests etc.,<br />In words of Jason van Zyl<br />"the intent of Maven is to make intra-project development highly manageable in the hopes of providing more time for cross-project development. You might call it cross-project pollination or the sharing of project development knowledge; this is what Maven attempts to encourage".<br />15/19<br />
  41. 41. Maven – Pom.xml<br />POM (Project Object Model) – XML representation of maven project<br />Declarative manifestation of “who” , “what” and “where”, while the build lifecycle is the “when” and “how”<br />Maven solves Dependency Management issues “jarmageddon” and “jar Hell” thru common local repository from which to link projects correctly <br />16/19<br />
  42. 42. Maven- Standard Layout for Projects<br />Java sources go under ${basedir}/src/main/java<br />Web stuff go under ${basedir}/src/main/webapp<br />Test sources go under ${basedir}/src/test/java<br />Compiled classes go under ${basedir}/target/classes<br />where ${basedir} represents the directory containing pom.xml<br />Maven local repository –~/.m2/repository<br />17/19<br />
  43. 43. So What’s Agile here ? <br />Don’t have to worry about build infrastructure – boiler plate<br />Don’t have to scratch your head on the different version of libraries<br />Don’t have to spend time on App server setup on your dev environment<br />Can develop “Runtime Environment Agnostic” Java code<br />Development is quick - Hot deployment on tcServer<br />Develop lean software – easy to support & maintain <br />And now you can actually concentrate on building application code <br />18/19<br />
  44. 44. Q & A<br />19/19<br />

×