private static void completeBatch(ApplicationContext context) throws InterruptedException { OrderGateway orderGateway = context.getBean(OrderGateway.class); orderGateway.completeBatch(10); Thread.sleep(5_000); }
private static void placeOrders(int orders, ApplicationContext context) { OrderGateway orderGateway = context.getBean(OrderGateway.class); IntStream.range(0, orders).parallel().forEach(i -> orderGateway.placeOrder()); }