Book Image

Learning Google Guice

By : Hussain Pithawala
Book Image

Learning Google Guice

By: Hussain Pithawala

Overview of this book

<p>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.</p> <p>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.</p> <p>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.</p>
Table of Contents (17 chapters)
Learning Google Guice
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Importing MySQL data


For running samples for Chapter 6, 7, and 8, the MySQL data dump has been provided in the file flights.sql. This file is present in the begin_guice/ directory. In order to check out if the samples for these chapters are running, follow the given steps:

  1. Start the MySQL server:

    shell> mysqld start
    
  2. Login as a root user into MySQL server:

    shell> mysql –uroot –A
    
  3. Create a database flights:

    mysql>create database flights;
    
  4. Grant the permission to a user flight with password as flight:

    mysql>grant all on flights.* to 'flight'@'localhost' identified by 'flight';
    
  5. Quit the MySQL console:

    mysql> quit;
    
  6. Import the data into the flights table from shell:

    shell> mysql flights -uflight -pflight < flights.sql
    
  7. Log back again with credentials for flight:

    shell>mysql flights -uflight -pflight
    
  8. Check the data:

    mysql>select * from flight;
    

The execution of last command would show the data in the table flight.

Prior to running the samples from Chapter 6 to Chapter 8, make sure the MySQL server is running.