Configuring Guice
To configure Guice, we must first add it as a dependency. We will add the Guice dependency independently to AWS Lambda functions, but it is also a good idea to have version information somewhere in the main project. That's why we export the guiceVersion
variable from the parent project's build.gradle
file first:
ext { guiceVersion = '4.1.+' }
Now we can add Guice's dependency to the lambda-authorizer
module's dependencies. Here, we did not create any build.gradle
file, so let's create it first:
$ touch lambda-authorizer/build.gradle
The, let's add the following content:
dependencies { compile group: 'com.google.inject', name: 'guice', version: guiceVersion }
At this step, it is also convenient to add the services-user
project as a dependency to this Lambda function. So, we can add also this line to the dependencies:
compile project(':services-user')
Now we can go on to creating a dependency injection configuration. Guice provides an AbstractModule
class to configure...