Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Java 9 Dependency Injection

You're reading from   Java 9 Dependency Injection Write loosely coupled code with Spring 5 and Guice

Arrow left icon
Product type Paperback
Published in Apr 2018
Publisher Packt
ISBN-13 9781788296250
Length 246 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Nilang Patel Nilang Patel
Author Profile Icon Nilang Patel
Nilang Patel
Krunal Patel Krunal Patel
Author Profile Icon Krunal Patel
Krunal Patel
Arrow right icon
View More author details
Toc

Summary


In this chapter, we learned how you can implement DI with Spring—one of the most popular frameworks for developing enterprise applications today. We have seen how the Spring container plays a vital role for managing bean life cycle.

We also learned how to define configurations that are XML and annotation-based. We also looked at different types of DI in depth, such as setter-based injection and constructor-based injection.

If you want to write your custom logic while creating instances of beans, you can now use the factory method in Spring. We also learned how to bind beans automatically with various modes, such as autowire by name, type, and constructor.

With the help of Java config, you can build Spring applications with zero XML. We saw various techniques for using Java config in the last section.

We will continue our journey and learn how to achieve DI in Google Guice, another popular framework that provides containers to achieve loosely coupled systems. We will explore them in the...

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 $15.99/month. Cancel anytime
Visually different images