The solution in your case will call saveOrderDetails(customerOrder); as proxyBean.saveOrderDetails(customerOrder); Where proxybean is the Object on which called proxybean is the Object on which handleIncomingOrders`.
If CustomerService is a singleton (Defualt scope), it can be as simple as adding the code below to the Service class. (adding self-determination as automatically)
//@Autowired CustomerService customerService; // As this is injected its a proxy
and in the method use it like
public CustomerOrder handleIncomingOrders(CustomerOrder customerOrder) { try { customerService.saveOrderDetails(customerOrder); ..... return customerOrder; } catch (Exception e)
If its scope is Prototype , one of the possible simple solutions would be as follows.
public CustomerOrder handleIncomingOrders(CustomerOrder customerOrder, CustomerService customerService) { try { customerService.saveOrderDetails(customerOrder); ..... return customerOrder; } catch (Exception e)
And where you call handleIncomingOrders use the changes suggested in the lower code.
bean.handleIncomingOrders(customerOrder); //Suppose this is old code Change it to bean.handleIncomingOrders(customerOrder, bean);// THough it appears as we are sending reference to `THIS` as parameter whcihc can be unnecessary, in case of `Proxy`while inside your method `this` and `Passed reference` will point to different Obejects.
source share