Lightweight J2EE development with Spring (special for UADEV)


Published on

Our presentation for UADev club on the "Spring va J2EE" topic.

Published in: Technology
1 Comment

    Feliz mes nuevo abundante de noviembre,


    ¿Cómo estás hoy?
    Espero que estés bien y que todo está bien con usted? gracias God.My nombre es jenifer PETERSON. (estoy buscando una buena relación y además que tenga propuesta de negocios con usted) si lo desea. por favor, escríbeme mensaje a mi buzón de correo electrónico

    jeniferpeterson1 en / yh / dt / cum


    Happy abundant new month of November,


    how are you today?
    I hope you are fine and all is well with you ? thank God.My name is JENIFER PETERSON .(i am looking for a good relationship and also to have business proposal with you )if you want. please write me message to my email box

    jeniferpeterson1 at / yh / dt / cum
    Are you sure you want to  Yes  No
    Your message goes here
  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • EJB 2x, Containers set-up, Spec immaturity
  • Bean tag attrubutes: id vs namep& c context
  • Bean tag attrubutes: id vs namep& c context Constur-argClasspath*:, file:,url:
  • Java code example of context usageBean overriding (id)
  • toString()
  • Locale resolver
  • Locale resolver
  • Spring Vaadin integration
  • Spring Vaadin integration
  • Polyglot persistence
  • Some words about JDBC
  • Some words about JDBC
  • Lightweight J2EE development with Spring (special for UADEV)

    1. 1. Lightweight EnterpriseJava Development using Spring Framework Oleksiy Rezchykov Eugene Scripnik
    2. 2. About us Software Engineers Working with Spring since 2006 Pragmatic programmers founders 2 @ua_spring #uadevclub
    3. 3. Contents Spring origins IoC using Spring Persistence with Spring Declarative caching using @Cachable Web applications with Spring MVC Spring ecosystem Framework criticism 3 @ua_spring #uadevclub
    4. 4. J2EE 5Development 4 @ua_spring #uadevclub
    5. 5. SpringFramework history In October 2002 Rod Johnson wrote his famous book The first milestone release 1.0 - June 2004 Company renamed from Interface21 to SpringSource in 2007 SpringSource acquired by VMWare in 2009 Rod Johnson left VMWare – July 2012 5 @ua_spring #uadevclub
    6. 6. Inversion of Control Inversion of regular approach where object was responsible for satisfying it’s own dependencies Implementation of Dependency Injection Container instantiates and wires dependencies 6 @ua_spring #uadevclub
    7. 7. Injection types Setter injection– when you are using setter to fulfill bean dependency Constructor injection – when constructor is called to set-up a bean with dependencies Method injection 7 @ua_spring #uadevclub
    8. 8. Context An object which contains beans declarations with their dependencies BeanFactory interface implementation 8 @ua_spring #uadevclub
    9. 9. XML namespaces 9 @ua_spring #uadevclub
    10. 10. 10 @ua_spring #uadevclub
    11. 11. Context usage 11 @ua_spring #uadevclub
    12. 12. Bean lifecycle Depends on scope and lazy initialization Main bean scopes: Singleton and Prototype(Also there are multiple web scopes) 12 @ua_spring #uadevclub
    13. 13. Bean instantiation order 13 @ua_spring #uadevclub
    14. 14. Bean Post-processing • Bean instantiated for singletons with Beaninstantiation eager initializationDependency • Dependencies are injected into beans injection • Bean post-processing actionsBean post-processing • You can put your custom logic in here 14 @ua_spring #uadevclub
    15. 15. Map, List, Set, Prop, Nul l 15 @ua_spring #uadevclub
    16. 16. Map, List, Set, Prop, Nul l 16 @ua_spring #uadevclub
    17. 17. Util namespace 17 @ua_spring #uadevclub
    18. 18. Component model 18 @ua_spring #uadevclub
    19. 19. @Autowired Spring proprietary annotation for property injection Supports @Qualifier to select implementation by name if more than one exists in context Has required parameter to enforce dependency loading 19 @ua_spring #uadevclub
    20. 20. @Autowired 20 @ua_spring #uadevclub
    21. 21. @Inject Context and Dependency Injection (CDI) standard JSR-299 21 @ua_spring #uadevclub
    22. 22. @Resource JSR 250 (Common annotations) Supports @PostConstruct and @PreDestroy as well 22 @ua_spring #uadevclub
    23. 23. Resource loading and i18n 23 @ua_spring #uadevclub
    24. 24. Resource loading and i18n 24 @ua_spring #uadevclub
    25. 25. SpEl Stands for Spring Expression Language Can be used in the xml context Can be used in bean classes 25 @ua_spring #uadevclub
    26. 26. 26 @ua_spring #uadevclub
    27. 27. Java Spring Config @Configuration @Bean Support for Environment and Profiles 27 @ua_spring #uadevclub
    28. 28. Java Spring Config 28 @ua_spring #uadevclub
    29. 29. Environment abstraction & context profiles Environment abstraction introduced in Spring 3.1 Can be declaratively and programmatically configured Affects property resolution Affects bean profiles 29 @ua_spring #uadevclub
    30. 30. Environment abstraction & context profiles 30 @ua_spring #uadevclub
    31. 31. AOPA programming paradigm which allows to separatecross-cutting concernsCross-cutting logic: Logging Tracing Security 31 @ua_spring #uadevclub
    32. 32. AOP Aspect Advice Join point Pointcut 32 @ua_spring #uadevclub
    33. 33. 33 @ua_spring #uadevclub
    34. 34. Spring AOP Spring AOP defaults to using standard J2SE dynamic proxies for AOP proxies. This enables any interface (or set of interfaces) to be proxied. Spring AOP can also use CGLIB proxies. This is necessary to proxy classes, rather than interfaces It is good practice to program to interfaces rather than classes, business classes normally will implement one or more business interfaces. 34 @ua_spring #uadevclub
    35. 35. AspectJ Spring AOP is often uses the AspectJ declaration style AspectJ itself uses Load Time Weaving (LTW) to modify the bean code according to Aspect logic LTW could do much more than dynamic proxies but it is more time-consuming operation. This means that LTW has a performance drawback. 35 @ua_spring #uadevclub
    36. 36. “pure” AspectJ 36 @ua_spring #uadevclub
    37. 37. “pure” AspectJ 37 @ua_spring #uadevclub
    38. 38. Persistence with Spring Building DAO Spring Data Embedded Datasources JDBC vs ORM DAO’s Integration testing with Spring @Transactional & transactions with Spring 38 @ua_spring #uadevclub
    39. 39. Spring supports JDBC JPA JDO Concrete ORM 39 @ua_spring #uadevclub
    40. 40. Spring Data RDBMS: JPA, JDBC Extensions BigData: ApacheHadoop DataGrid: GermFire HTTP: REST Key-value stores: Redis Document Stores: MongoDB Graph Databases: Neo4j Column stores: Hbase 40 @ua_spring #uadevclub
    41. 41. Persistence layer • Persistence service which has domain specific logic Service • Spring JDBCTemplate • SessionFactory, EntityManagerFactoryRepository (DAO) • Redis/Mongo template • RDBMS (or NoSQL) DB 41 @ua_spring #uadevclub
    42. 42. JDBCTemplate Useful interface No boilerplate code Exception handling 42 @ua_spring #uadevclub
    43. 43. JDBCTemplate 43 @ua_spring #uadevclub
    44. 44. JDBC namespace 44 @ua_spring #uadevclub
    45. 45. Spring Data JPA CRUD 45 @ua_spring #uadevclub
    46. 46. Spring Data JPA Query DSL 46 @ua_spring #uadevclub
    47. 47. Transactions in Spring Support for ACID transactions Declarative and programmatic 47 @ua_spring #uadevclub
    48. 48. Transaction managers Spring support both container managed and framework managed transactionsManagers: DataSourceTransactionManager HibernateTransactionManager JPATransactionManager JTATransactionManager 48 @ua_spring #uadevclub
    49. 49. @Transactional Transaction propagation Read-only transactions Built using Spring AOP 49 @ua_spring #uadevclub
    50. 50. Persistence layer testing Context loading in test Environment abstraction and profiles usage Transactional methods Embedded data source could be used 50 @ua_spring #uadevclub
    51. 51. Persistence layer testing 51 @ua_spring #uadevclub
    52. 52. @Cacheable One-two-three magic (not always work as expected) Support for JCache (JSR-107) 52 @ua_spring #uadevclub
    53. 53. @Cacheable <cache:annotation-driven> or @EnableCaching CacheManager instance in the context @Cacheable, @CachePut, @CacheEvict 53 @ua_spring #uadevclub
    54. 54. Spring MVC Application context Dispatcher Servlet and it’s context Controllers and mappings Implementing CRUD logic REST Testing MVC 54 @ua_spring #uadevclub
    55. 55. Application & Dispatcher servlet context 55 @ua_spring #uadevclub
    56. 56. Front controller and MVC 56 @ua_spring #uadevclub
    57. 57. URL mappings @RequestMapping 57 @ua_spring #uadevclub
    58. 58. View resolvers AbstractCachingViewResolver XmlViewResolver ResourceBundleViewResolver UrlBasedViewResolver InternalResourceViewResolver VelocityViewResolver / FreeMarkerViewResolver ContentNegotiatingViewResolver 58 @ua_spring #uadevclub
    59. 59. View resolvers 59 @ua_spring #uadevclub
    60. 60. CRUD in one place 60 @ua_spring #uadevclub
    61. 61. REST in Spring MVC Starting Spring 3.1.x ContentNegotiatingViewResolver @ResponseBody combined with produces @RequestBody combined with consumes 61 @ua_spring #uadevclub
    62. 62. REST in Spring MVC 62 @ua_spring #uadevclub
    63. 63. Testing MVC Starting from Spring 3.2 spring-test-mvc project Server-side Spring MVC tests New Spring Mocks Different strategies 63 @ua_spring #uadevclub
    64. 64. Testing MVC 64 @ua_spring #uadevclub
    65. 65. Testing MVC 65 @ua_spring #uadevclub
    66. 66. Just to mention Type conversion Formatter SPI 66 @ua_spring #uadevclub
    67. 67. Just to mention Type conversion Formatter SPI 67 @ua_spring #uadevclub
    68. 68. Just to mention Flash attributes and Redirect attributes 68 @ua_spring #uadevclub
    69. 69. Spring in 2012 69 @ua_spring #uadevclub
    70. 70. Just to mention Spring Roo Spring Hadoop Spring Android 70 @ua_spring #uadevclub
    71. 71. Criticism Every tool should be used only if you could not solve your task without it – KISS When a lot of stuff come out-of-the-box it is not always good - YAGNI When something is broken it is pain in the … Open source but VMWare 71 @ua_spring #uadevclub
    72. 72. Sources g-framework-reference/html/index.html example webapps/ 72 @ua_spring #uadevclub
    73. 73. Questions? 73 @ua_spring #uadevclub