Take a Closer Look - Order Service

Let’s drill into one of the services by opening the service folder. Here you’ll see the various product and order related files that implement our services. There are interfaces (OrderService.java, for example) and an implementation file (OrderServiceImpl.java). Let’s open the OrderServiceImpl.java file by double-clicking the file name in the left-hand pane. Below is a snippet of code from this file:

@Autowired
private OrderDao orderDao;

@Override
public List<Order> getOrders() throws Exception {
    logger.info("OrderService::getOrders");
    StopWatch timer = new StopWatch();
    timer.start();
    List<Order> orders = orderDao.getOrders();
    timer.stop();
    logger.info("OrderService::getOrders exec " + timer.getTotalTimeMillis());
    return orders;
}

@Override
public Order getOrder(Integer orderId) throws Exception {
    logger.info("OrderService::getOrder " + orderId);
    StopWatch timer = new StopWatch();
    timer.start();
    Order order = orderDao.getOrder(orderId);
    timer.stop();
    logger.info("OrderService::getOrder exec " + timer.getTotalTimeMillis());
    return order;
}

Here you see a few methods of our Order service that process GET requests from the client. The first code processes request to get all orders and the second request gets a single order based on an order identifier. This is standard monolith code that has no tenant awareness.