Just Spring

Book description

Get a concise introduction to Spring, the popular open source framework for building lightweight enterprise applications on the Java platform. This example-driven book for Java developers delves into the framework’s basic features, as well as complex concepts such as containers. You’ll learn how Spring makes Java Messaging Service easier to work with, and how its support for Hibernate helps you work with data persistence and retrieval.

In this revised edition of Just Spring, you’ll get your hands deep into sample code, beginning with a problem that illustrates Spring’s core principle: dependency injection. In the chapters that follow, author Madhusudhan Konda walks you through features that underlie the solution.

  • Dive into the new chapter on advanced concepts, such as bean scopes and property editors
  • Learn dependency injection through a simple object coupling problem
  • Tackle the framework’s core fundamentals, including beans and bean factories
  • Discover how Spring makes the Java Messaging Service API easier to use
  • Learn how Spring has revolutionized data access with Java DataBase Connectivity (JDBC)
  • Use Spring with the Hibernate framework to manipulate data as objects

Publisher resources

View/Submit Errata

Table of contents

  1. Just Spring
  2. A Note Regarding Supplemental Files
  3. Preface
    1. Conventions Used in This Book
    2. Using Code Examples
    3. Safari® Books Online
    4. How to Contact Us
    5. Content Updates
      1. September 23, 2011
      2. February 28, 2013
    6. Acknowledgments
  4. 1. Basics
    1. Introduction
    2. Object Coupling Problem
      1. Designing to Interfaces
    3. Introducing Spring
      1. Dependency Injection
      2. Refactoring IReader by Using the Framework
      3. ReaderService
    4. Summary
  5. 2. Fundamentals
    1. Configuring Beans
      1. Using XML
      2. Using Annotations
      3. XML Namespaces
    2. Creating Beans
    3. Life Cycle
      1. Instantiating Beans Without Dependencies
      2. Instantiating Beans With Dependencies
    4. Aliasing Beans
    5. Anonymous Beans
    6. Injection Types
      1. Constructor Type Injection
        1. Argument type resolution
      2. Setter Type Injection
      3. Mixing Constructor and Setter
    7. Bean Callbacks
      1. init-method
      2. destroy-method
      3. Common Callbacks
    8. Summary
  6. 3. Containers
    1. Containers
      1. BeanFactory Container
      2. ApplicationContext Container
    2. Instantiating Beans
      1. Using Static Methods
      2. Using Factory Methods
    3. Initialization and Destruction Callbacks
      1. InitializingBean’s afterPropertiesSet
      2. DisposableBean’s destroy
      3. Declarative or Programmatic Callbacks?
    4. Event Handling
      1. Listening to Context Events
      2. Publishing Custom Events
      3. Event Model Is Single Threaded
    5. Autowiring
      1. Autowiring byName
      2. Autowiring byType
      3. Autowiring by constructor
      4. Mixing Autowiring with Explicit Wiring
    6. Summary
  7. 4. Advanced Concepts
    1. Bean Scopes
      1. Singleton Scope
      2. Prototype Scope
    2. Property Files
    3. Property Editors
      1. Injecting Java Collections
        1. Using lists, sets and maps
      2. Injecting Java Properties
    4. Bean Post Processors
    5. Parent-Child Bean Definitions
    6. Summary
  8. 5. Spring JMS
    1. Two-Minute JMS
      1. Messaging Models
        1. Point-to-point messaging
        2. Pub/sub messaging
    2. Spring JMS
      1. Mother of All: The JmsTemplate Class
      2. Publishing Messages
      3. Sending Messages to Default Destination
      4. Declaring a Topic
      5. Receiving Messages
      6. Receiving Messages Synchronously
      7. Receiving Messages Asynchronously
      8. Spring Message Containers
      9. Message Converters
    3. Summary
  9. 6. Spring Data
    1. JDBC and Hibernate
      1. Spring JDBC
        1. JdbcTemplate
        2. Configuring JdbcTemplate
        3. Using JdbcTemplate
        4. Returning domain objects
        5. Manipulating data
      2. Hibernate
        1. Using old style HibernateTemplate
        2. Preferred style—using native API
    2. Summary
  10. About the Author
  11. Colophon
  12. Copyright

Product information

  • Title: Just Spring
  • Author(s): Madhusudhan Konda
  • Release date: July 2011
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9781449306403