Last active
June 19, 2019 18:26
-
-
Save jianwu/0511f117fb1a322759daebab34b9d4ff to your computer and use it in GitHub Desktop.
A typical component in DI every approach
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class OderSericeImpl implement OrderService { | |
private final ShoppingCartService cartService; | |
private final PricingService pricingService; | |
private final InventoryService inventoryService; | |
private final UserSession userSession; | |
private final TimeProvider timeProvider; | |
// ... and many more, this list will keep increasing when more requirements added | |
public OrderService( | |
ShoppingCartService cartService, | |
PricingService pricingService, | |
InventoryService inventoryService, | |
UserSession userSession, | |
TimeProvider timeProvider) { | |
this.cartService = cartService; | |
this.pricingService = pricingService; | |
// .... | |
} | |
public CreateOrderResponse createOrder(CreateOrderRequest req) { | |
// ... | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment