Free Sample
+ Collection

Learning Google Guice

Learning
Hussain Pithawala

Develop your Java applications faster and more efficiently by learning dependency injection using Google Guice. This guide is the perfect introduction, covering both basic and advanced topics with a user-friendly approach.
$17.99
$29.99
RRP $17.99
RRP $29.99
eBook
Print + eBook

Want this title & more?

$21.99 p/month

Subscribe to PacktLib

Enjoy full and instant access to over 2000 books and videos – you’ll find everything you need to stay ahead of the curve and make sure you can always get the job done.

Book Details

ISBN 139781783281893
Paperback126 pages

About This Book

  • Detailed coverage of the various features of Guice such as the Injector, Bindings, Providers, TypeLiterals, Scoping, Multibinders, and so on
  • Learn how to use the various Guice-throwing providers, Guice-multibinder, Guice-servlet, Guice-struts2, and Guice-persist in various areas of application development
  • Focus on web application development using Struts 2, Hiberate 3, and JPA 2 while managing dependencies using Guice
  • Coverage of advanced topics such as extending Guice to cater for your specific requirements

Who This Book Is For

Learning Google Guice is for anyone having a minimal understanding of application development in Java and keen to learn dependency injection using Guice. Architects and Lead programmers, who are into designing structure of the application would benefit from various recipes to be leveraged during developing infrastructure pieces.  It is assumed that readers will have a basic knowledge of dependency injection; however, this is not an obligation.

Table of Contents

Chapter 1: Getting Started with Guice
Wiring dependencies
Comparing two approaches
Building and Running the examples
Summary
Chapter 2: Exploring Google Guice
Meet the injector
Configuring a module to write bindings
Static injection
Summary
Chapter 3: Diving Deeper in Guice
Going the extra mile with Providers
AssistedInject
Binding collections
Scoping
Summary
Chapter 4: Guice in Web Development
Structure of flightsweb application
Using GuiceFilter
Rolling out our ServletContextListener interface
ServletModule – the entry point for configurations
Binding language
Web scopes
Summary
Chapter 5: Integrating Guice with Struts 2
Introducing Struts 2
Summary
Chapter 6: Integrating Guice with JPA 2
Introduction to JPA 2 and Hibernate 3
Guice 3 with JPA 2
FlightSearch application with JPA 2 and Hibernate 3
Summary
Chapter 7: Developing Plugins and Extensions using Guice
Developing a plugin
Guice SPI (Service Provider Interface)
Exploring a custom extension, guice-multibinder
Summary
Chapter 8: AOP with Guice
What is AOP?
How AOP works?
How Guice supports AOP?
Concerns related to performance
Summary

What You Will Learn

  • Optimize dependency injection using Guice as a solution
  • Develop a fictitious application harnessing the advanced features of Guice
  • Learn the intricacies of Binding, Scoping, and Injection
  • Master the various aspects of Guice pertaining to different areas of application development in Java
  • Learn how to harness the Guice-servlet extension for web development using Struts 2, JSP, Servlets, and Hibernate 3
  • Leverage AOP using Guice implementation of aopalliance.
  • Learn how to develop extensions using the Guice SPI

In Detail

Google Guice is an open source software framework for the Java platform released by Google under the Apache License. It provides support for dependency injection using annotations to configure Java objects.

Learning Google Guice is a concise, hands-on book that covers the various areas of dependency injection using the features provided by the latest version of Google Guice. It focuses on core functionalities as well as the various extensions surrounding Guice that make it useful in other areas like web development, integration with frameworks for web development, and persistence.

Learning Google Guice covers Guice extensions which avoid complex API usage. You will start by developing a trivial application and managing dependencies using Guice. As the book gradually progresses, you will continue adding complexity to the application while simultaneously learning how to use Guice features such as the Injector, Provider, Bindings, Scopes, and so on. Finally, you will retrofit the application for the Web, using Guice not only to manage dependencies, but also to solve configuration related problems.

Authors

Read More