jeudi 26 mars 2020

Need to autowire same bean in two different controllers

I have 2 urls and two different controllers

  1. localhost:8080/myservice/foo/1/0/updatesStatus --> FooController
  2. localhost:8080/myservice/bar/1/0/updatesStatus --> BarCOntroller

For both the controller I need to autowire the same Service class.

MyService --> Interface and MyServiceImpl --> Implementation class.

@Autowired
MyService myService;

In MyServiceImpl I am updating database tables based on URL. At any point in time If both requests came at the same time with both controllers using the same service, will there be any impact like one request updating other data or fetching the wrong fields?

Aucun commentaire:

Enregistrer un commentaire