@Autowired private UserService userService;
@Service public class OrderService {
private final PaymentService paymentService;
private final NotificationService notificationService;
// 连@Autowired都不用写了
public OrderService(PaymentService paymentService,
NotificationService notificationService) {
this.paymentService = paymentService;
this.notificationService = notificationService;
}
}