Spring Python 1.1

Spring Python 1.1
eBook: $26.99
Formats: PDF, PacktLib, ePub and Mobi formats
save 15%!
Print + free eBook + free PacktLib access to the book: $71.98    Print cover: $44.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Table of Contents
Sample Chapters


  • Maximize the use of Spring features in Python and develop impressive Spring Python applications
  • Explore the versatility of Spring Python by integrating it with frameworks, libraries, and tools
  • Discover the non-intrusive Spring way of wiring together Python components
  • Packed with hands-on-examples, case studies, and clear explanations for better understanding 

Book Details

Language : English
Paperback : 264 pages [ 235mm x 191mm ]
Release Date : May 2010
ISBN : 1849510660
ISBN 13 : 9781849510660
Author(s) : Greg L. Turnquist
Topics and Technologies : All Books, Application Development, Open Source, Python

Table of Contents

Chapter 1: Getting Started with Spring Python
Chapter 2: The Heart of Spring Python—Inversion of Control
Chapter 3: Adding Services to APIs
Chapter 4: Easily Writing SQL Queries with Spring Python
Chapter 5: Adding Integrity to your Data Access with Transactions
Chapter 6: Securing your Application with Spring Python
Chapter 7: Scaling your Application Across Nodes with Spring Python's Remoting
Chapter 8: Case Study I—Integrating Spring Python with your Web Application
Chapter 9: Creating Skeleton Apps with Coily
Chapter 10: Case Study II—Integrating Spring Python with your Java Application
  • Chapter 1: Getting Started with Spring Python
    • Spring Python for Python developers
      • Exploring Spring Python's non-invasive nature
      • Adding in some useful templates
    • Spring Python for Java developers
    • Extending Spring Python
    • Installing Spring Python
      • Setting up an environment for Spring Python
      • Installing from a pre-built binary download
      • Installing from source
    • Spring Python community
    • Summary
  • Chapter 2: The Heart of Spring Python—Inversion of Control
    • Swapping production code with test doubles
      • More about Inversion of Control
      • Adding Inversion of Control to our application
      • Dependency Injection a.k.a. the Hollywood principle
      • Adding Inversion of Control to our test
    • Container versus Context
      • Lazy objects
      • Scoped objects
      • Property driven objects
      • Post processor objects
      • Context aware objects
    • Debate about IoC in dynamic languages
    • Migrating a Spring Java application to Python
    • Summary
  • Chapter 3: Adding Services to APIs
    • AOP from 10,000 feet
      • Crosscutting versus hierarchical
      • Crosscutting elements
      • Weaving crosscutting behavior
    • Adding caching to Spring Python objects
      • Applying many advisors to a service
      • Performance cost of AOP
    • AOP is a paradigm, not a library
      • Distinct features of Spring Python's AOP module
      • The risks of AOP
      • AOP is part of the Spring triangle
    • Testing our aspects
      • Decoupling the service from the advice
      • Testing our service
      • Confirming that our service is correctly woven into the API
    • Summary
  • Chapter 4: Easily Writing SQL Queries with Spring Python
    • The classic SQL issue
      • Parameterizing the code
      • Replacing multiple lines of query code with one line of Spring Python
    • The Spring triangle—Portable Service Abstractions
    • Using DatabaseTemplate to retrieve objects
      • Mapping queries by convention over configuration
      • Mapping queries into dictionaries
    • DatabaseTemplate and ORMs
      • Solutions provided by DatabaseTemplate
      • How DatabaseTemplate and ORMs can work together
    • Testing our data access layer with mocks
    • How much testing is enough?
    • Summary
  • Chapter 5: Adding Integrity to your Data Access with Transactions
    • Classic transaction issues
      • Creating a banking application
      • Transactions and their properties
      • Getting transactions right is hard
    • Simplify by using @transactional
      • More about TransactionTemplate
    • The Spring Triangle—Portable Service Abstractions
    • Programmatic transactions
      • Configuring with the IoC container
      • Configuring without the IoC container
      • @transactional versus programmatic
    • Making new functions play nice with existing transactions
      • How Spring Python lets us define a transaction's ACID properties
    • Applying transactions to non-transactional code
    • Testing your transactions
    • Summary
  • Chapter 6: Securing your Application with Spring Python
    • Problems with coding security by hand
    • Building web applications ignoring security
      • Looking at our web application from 10,000 feet
    • Handling new security requirements
      • Authentication confirms "who you are"
      • Authorization confirms "what you can do"
    • Time to add security to our application
    • Accessing security data from within the app
    • Testing application security
    • Configuring SQL-based security
    • Configuring LDAP-based security
    • Using multiple security providers is easy
      • Migrating from an old security solution to a new one
      • Supporting multiple user communities
      • Providing redundant security access
    • Coding our own security extension
      • Coding a custom authentication provider
    • Some of the challenges with Spring Python Security
    • Summary
  • Chapter 7: Scaling your Application Across Nodes with Spring Python's Remoting
    • Introduction to Pyro (Python Remote Objects)
    • Converting a simple application into a distributed one on the same machine
      • Fetching the service from an IoC container
      • Creating a client to call the service
      • Making our application distributed without changing the client
      • Is our example contrived?
      • Spring Python is non-invasive
    • Scaling our application
      • Converting the single-node backend into multiple instances
      • Creating a round-robin dispatcher
      • Adjusting client configuration without client code knowing its talking to multiple node backend
    • Summary
  • Chapter 8: Case Study I—Integrating Spring Python with your Web Application
    • Requirements for a good bank
    • Building a skeleton web application
    • Securing the application
    • Building some basic customer functions
    • Coding more features
      • Updating the main page with more features
      • Refining the ability to open an account
      • Adding the ability to close an account
      • Adding the ability to withdraw money
      • Adding the ability to deposit money
      • Adding the ability to transfer money
      • Showing account history
    • Issues with customer features
      • Securing Alice's accounts
      • Adding overdraft protection to withdrawals
      • Making transfers transactional
    • Remotely accessing logs
    • Creating audit logs
    • Summary

Greg L. Turnquist

Greg has worked since 1997 as a software engineer at Harris Corporation, always seeking the right tool for the job. Since 2002, Greg has been part of the senior software team working on Harris' $3.5 billion FAA telco program, architecting mission-critical enterprise apps while managing a software team. He provides after hours support and 2nd-level engineering to support the nation-wide telco network and is no stranger to midnight failures and software triage. In 2010, Greg joined the SpringSource division of VMware.

Being a test-bitten script junky, Greg has used JUnit, TestNG, JMock, FEST, PyUnit, and pMock testing frameworks, along with other agile practices to produce top-quality code.

He has worked with Java, Spring, Spring Security, AspectJ, and Jython technologies and also developed sophisticated scripts for *nix and Windows platforms. Being a wiki evangelist, he also deployed a LAMP-based wiki website to provide finger-tip knowledge to users.

In 2006, Greg created the Spring Python project. The Spring Framework provided many useful features, and he wanted those same features available when working with Python.

Greg completed a master's degree in Computer Engineering at Auburn University, and lives in the United States with his family.

Sorry, we don't have any reviews for this title yet.

Code Downloads

Download the code and support files for this book.

Submit Errata

Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.

Sample chapters

You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

Frequently bought together

Spring Python 1.1 +    JBoss Drools Business Rules =
50% Off
the second eBook
Price for both: $39.00

Buy both these recommended eBooks together and get 50% off the cheapest eBook.

What you will learn from this book


  • Use the most advanced Inversion of Control or Dependency Injection container for Python
  • Quickly write SQL queries without having to manage the connections
  • Plug-in raw SQL without having to learn another query language
  • Find out how to scale your application by spreading your components across multiple machines
  • Link Python and Java components together with little effort through the power of Jython
  • Learn how to add security to your Python application without breaking the bank
  • Utilize sophisticated database transactions without rewriting your application
  • Configure database or LDAP-based Spring Security for your Python application
  • Split your single-node application into a multi-node, scalable application with minimal changes
  • Discover how to use Spring Python's command-line utility and write your own plugin
  • See how all the blocks work together in the case studies—filled with code samples, screenshots, and high-level diagrams

In Detail

Spring Python captures the concepts of the Spring Framework and Spring Security and brings them to the world of Python and provides many functional parts to assemble applications. Spring Python is all about using the many useful features of Spring to the fullest and making these features available when working with Python.

Get to grips with all of the concepts of Spring and apply these to the language and environment of Python to develop powerful applications for your own personal requirements. The book provides an introduction to Spring Python and steadily takes you towards the advanced features that this integration has to offer.

Spring uses the Java programming language. Spring Python, the first Spring extension to go live, allows developers to make maximum use of Spring features in Python. This book starts off by introducing each of the core building blocks of Spring Python using real code examples and high-level diagrams. It explores the various concepts of Spring Python with the help of examples and case studies and focuses on vital Spring Python features to make the lives of Python and Java developers simple. The early chapters cover simple applications with simple operations including data access, and then subsequent chapters scale up to multi-node, secured, transactional applications stopping short of very advanced level complexity.

This book will help you to scale your applications without having to add unnecessary complexity


The book is an introduction to Spring Python. It starts with simple practical applications, moving on to more advanced applications with two advanced case studies at the end of the book. It is packed with screenshots, examples, and ready-to-use code making it very suitable for a beginner while also showing tactics and concepts suitable for the most experienced developers. Each chapter starts with a simple problem to solve, and then dives into how Spring Python provides the solution with step-by-step code samples. Along the way, screenshots and diagrams are used to show critical parts of the solution. The case studies start off with a handful of use cases, and then proceed step-by-step to incrementally develop features. Some use cases are left to the reader to implement as an exercise. Key problems discovered along the way are exposed and then solved, giving the reader the chance to solve them, or to read the author's solutions.

Who this book is for

This book is for Python developers who want to take their applications to the next level, by adding/using parts that scale their application up, without adding unnecessary complexity. It is also helpful for Java developers who want to mix in some Python to speed up their coding effort.

Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software