Presentation is loading. Please wait.

Presentation is loading. Please wait.

Spring Fling Phillip Warner. Spring Framework ● Dependency Injection (DI) Framework – “Inversion of Control” ● Facilitates Good Programming Practices.

Similar presentations


Presentation on theme: "Spring Fling Phillip Warner. Spring Framework ● Dependency Injection (DI) Framework – “Inversion of Control” ● Facilitates Good Programming Practices."— Presentation transcript:

1 Spring Fling Phillip Warner

2 Spring Framework ● Dependency Injection (DI) Framework – “Inversion of Control” ● Facilitates Good Programming Practices ● Facilitates Testing ● Unobtrusive ● Simplifies J2EE/Java EE

3 Goals ● Let's see some code – Code examples ● Deployment through Spring configuration – XML – Spring configuration examples ● Interesting potential? – What might you do with Spring?

4 Example 1 – StdoutPrinter ● StdoutPrinter.java – prints to STDOUT ● spring-config.xml – Spring configuration (by setter) ● SpringLoader.java – Spring container Loader ● spring-config-constructor.xml – Spring configuration example (by constructor)

5 Example 2 – SimpleCalculator ● Operator.java – interface for defining operations ● Add.java, Subtract.java implementations of Operator interface ● Calculator.java – Calculator interface ● SimpleCalculator.java – Calculator implementation. ● SpringLoader.java and AutoSpringLoader.java – Two ways to run the code

6 Example – VOEvent ● What is VOEvent? – IVOA standard for building and sending XML-based event notices (e.g., SNe, g-ray Bursts, Moving objects) – VOEvent is a broker developed by NOAO ● Provides event publishing, persistence, classification ● Provides event subscription mechanism

7 Example – VOEvent ● Basic configuration for: – Server/broker ● Publishing, persistence, classification, relay (sending events), and subscription service – Client (author) ● Author events for publication – Client (subscriber) ● Subscription to TCP-based event streams

8 VOEvent – Classification ● Rules-based ● Spring-configured – For initial implementation—before a database backend and supporting services are provided

9 VOEvent – Classification (2)

10 VOEvent – Classification (3)

11 VOEvent – Classification (4)

12 Example – Dynamic Workflows

13 Example – Dynamic Workflows (2)

14

15 Spring – Other Features ● Autowiring – Automatic dependency injection ● byType, byName, constructor, autodetect ● Bean scopes – singleton (default), prototype – request, session, global-session (web) – custom

16 Spring – Other Features ● Annotation-based – Used with auto-wiring, e.g., ● @Autowired – tell Spring where the dependency should be injected ● @Resource – (JSR-250) resource injection a la Java EE 5 and 6 ● @PostConstruct, @PreDestroy (JSR-250) – could be used in legacy or code-based resource allocation – See www.springframework.org for more details

17 Spring – Schema-based Configuration ● – Provides for static definition of: ● Configuration (properties, etc.) ● Collections ● constants – simplifies defining static information – alternative? ● define a bean for each set of information

18 Spring – Schema-based Configuration ● – Provides for configuration of some Java Enterprise features ● JNDI lookup ● EJB lookup ● – Provides for JMS support ● – Support for Spring's declarative TX management

19 Spring – Schema-based Configuration ● – Support for AOP (Spring-based) ● – Further support for context configuration ● Spring context, e.g., ApplicationContext ● – Provides support for dynamic languages ● Currently JRuby, Groovy, BSH – Provides support for inlining code

20 Spring Projects http://www.springframework.org/projects

21 And so on... For more details, see: http://www.springframework.org


Download ppt "Spring Fling Phillip Warner. Spring Framework ● Dependency Injection (DI) Framework – “Inversion of Control” ● Facilitates Good Programming Practices."

Similar presentations


Ads by Google