Post on 20-May-2015
2. Spring is a collection of frameworks:
Data Access,Transaction Management, Security 3. Remote Access Framework 4. Spring Dynamic Modules 5. Aspects a way to deal with cross cutting concerns 6. MVC an alternative to web application frameworks like Struts 7. Spring does not re-invent the wheel
8. Uses existinganything:ORM, transactions, Aspects, Remoting, etc. 9. Spring is there to provide portability betweenframeworks that share a purpose and interface 10. Spring Frameworks are Abstractions
11. Implemented by a variety of solutions:
Injected into your code by the config file using the Java Bean Interface (more) 12. Leaving your code simple and full of POJOs (more later) 13. When needs require a different implementation, very easy to change the config file with no code changes 14. Detail: Java Bean
Not anEntityJava Bean or EJB 15. Detail: POJO
Meaning it's not tied to a particular framework. 16. Inversion of Control or Dependency Injection?
17. Dependency Injection is a more specific concept that refers to setting values on objects (Java Beans) from an external source. 18. Spring calls the framework IoC. 19. I call the concept used here DI. 20. Detail: IoC
21. Even with good modularity, you still hard-code them together with code like this: 22. public static void main(String args[]) { DataProvider dp = new DataProvider(); CorpMetrics metrics = new CorpMetrics(); metrics.calculate(dp); 23. Detail: IoC 2
24. A JDBC setup finds its database connection by consulting JNDI, making environmental assumptions: Context initContext = new InitialContext(); Context envContext= (Context)initContext.lookup("java:/comp/env"); DataSource ds = (DataSource)envContext.lookup("jdbc/myoracle"); Connection conn = ds.getConnection(); ( http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html ) 25. Changes still involve changing the java code. 26. Detail: IoC 3
27. Hard-coded constructor calls limit it. 28. Unit Testing with different configurations is made easier. 29. IoC is used as a supporting technology throughout Spring 30. UIMA users, as described in a 2009 poster paper, would find this eerily familiar
31. Detail: IoC 4
32. Code to Interfaces 33. Create new implementations of Classes that implement them. 34. Easy to swap with a different implementation when both implement the same Java interface. 35. Also works to enable a kind of multiple inheritance in Java. 36. Survey: Data Access
37. Operations on entities built in Data Access Objects (DAO)
Spring provides templates to make building DAOs easy 38. BTW, these are used in FLEX integration 39. Survey: Transaction Management
40. Databases handle their own transactions:
EJB containers allow transactions between multiple systems 41. Coding to Spring allows flexibility and growth 42. Survey: Remote Access
43. Abstracts the concept of remoting and provides different implementations. 44. Client and service objects are POJOs. 45. Can make use of JSR-181 Web Services Metadata annotations 46. Survey: Dynamic Modules
47. provide another layer of encapsulation over the concept of Class. Now you can have private and public classes as members of a module (jar). 48. allow for a lifecycle, so module can have a running state. 49. provide better naming, so versions can be included. 50. provide restricted class space, allowing for more than one version of a class at the same time. 51. More: Yuriy is working on this 52. Survey: Aspects
53. Logging, Transactions, Security 54. Makes use of a proxy facility in Java reflection.
55. The proxy intercepts function calls and allows implementations of a Handler interface to intercept them. Other Implementations exist, but are intrusive. 56. Survey: MVC
57. View the JSP pages to render a web page 58. Controller the plumbing or routing A kind of Model 2 architecture where a controller servlet controls creates beans and introduces them to JSPs
59. Links