Personal tools
You are here: Home Members ironstorm Core Spring Notes
Document Actions

Core Spring Notes

by ironstorm last modified 2008-04-04 16:23
<!-- @page { size: 8.5in 11in; margin: 0.79in } P { margin-bottom: 0.08in } H3 { margin-bottom: 0.08in } H3.western { font-family: "Arial", sans-serif } H3.cjk { font-family: "MS Mincho" } -->


Cookbooks

  • Lab like activities + samples

Spring AOP

  • 2 Ways

    • Dynamic Proxies

      • Natively supported by JVM

      • Only interface methods can be advised

      • Internal calls within a class call this and are not proxied/advised.

      • Arguments - * -> any type, .. -> any # of args of any type (0..n). i.e. int, ..

    • CGLib Target Class is extended via byte code injection to create a subclass

      • Slower (non-JVM native bytecode injection)



  • REQUIRED - create a new TX or run within existing TX

  • MANDATORY – run within an existing TX or throw an exception


Spring Web Frameworks

  • getApplicationRequiredContext – Fails immediately if the application context has not been initialized properly.


Web Intro Lab

  • Date formatting issue.


Spring @MVC

  • DispatcherServletContext inherits from RootWebAppliactionContext (root application context).

  • Do not <import/> the root application context into the child DispatcherServletContext , this would result in duplication of the RootWebAppliactionContext its inherited automatically.


DispatcherServletContext

RootWebAppliactionContext


Slide 38 -

@Controller is a subclass of @Component

so <context:component-scan base-package=”rewardsadmin”/>

using @Autowired and @RequestMapping you don't need to configure anything in spring application config..


Advanced Spring MVC – Slide 12

  • Annotation + app-context scan is good for small applications

  • XML for the controller class is good when application gets large and finding which class has the annotation for a mapping becomes difficult.

XML based config

  • ControllerClassNameHandleMapping

    • .RewardsController -> maps url “/rewards*”


@InitBinder to do data validation


Spring Web Flow

  • Spring IDE has a bug that displays errors on Spring Flow Definitions on some SWF files

  • Conversation and Flow Scopes (flowExecutionKey=_conversation123_flow456)

    • flow scope – at each continuation in a conversation

    • conversation scope – available to all continuations within a conversation

    • a conversation is a flow entry point and set of continuations (subsequent back and forth requests)

  • Flow Persistence

    • Continuation – in session

    • Conversation-based storage (1 state per flow, no per continuation scope)

    • Session Based – saves whole session to client side (no scope storage on server side)

    • Database not out of the box – but possibly useful to pass conversation to another user (i.e. Administrator) to complete flow


Spring Remoting

  • org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter needs spring MVC as it is a @Controller

  • What to use when -- see Slide 29


Spring Web Services

  • Accept liberal inbound messages by querying for important data elements with with XPath


JMS

  • DynamicResolution – resolve Queue by Queue or Topic name

  • response-destination is a default, if there is a response destination in the message header that value will override the response queue.

  • Spring JMS Listener is by default a thread-safe singleton


Tasks

  • ThreadPoolTaskExecutor (JDK 5.0)

  • Queue conflation -> not out of the box


Powered by Plone, the Open Source Content Management System

This site conforms to the following standards: