Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Building Serverless Architectures

You're reading from   Building Serverless Architectures Unleash the power of AWS Lambdas for your applications

Arrow left icon
Product type Paperback
Published in Jul 2017
Publisher Packt
ISBN-13 9781787129191
Length 242 pages
Edition 1st Edition
Languages
Tools
Concepts
Arrow right icon
Author (1):
Arrow left icon
Cagatay Gurturk Cagatay Gurturk
Author Profile Icon Cagatay Gurturk
Cagatay Gurturk
Arrow right icon
View More author details
Toc

Service dependencies

Often, the services we declare have other dependencies. For example, our user service needs a repository service to access the persistence layer. How do we declare these nested dependencies and get the Guice construct to the dependency graph for us?

We can leverage JSR-330 annotations again to declare dependencies for other dependencies. As always, let's look at this in action. Let's start with creating the UserRepository interface in the com.serverlessbook.services.user.repository package:

    $ mkdir -p services-user/src/main/java/com/
serverlessbook/services/user/repository

$ touch services-user/src/main/java/com/serverlessbook/
services/user/repository/UserRepository.java

Inside the interface, let's declare the method we need at this stage:

package com.serverlessbook.services.user.repository; 
import com.serverlessbook.services...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image