Using AbstractRoutingDataSource
I have implemented read-write Datasource separation in the HTTP request label (essentially assigning a request to a DataSource and sticking with it for the entire request)
In my case, first I have to fetch some data, modify those data and then persist in the database, here first I need READ-ONLY Datasource then UPDATABLE within the same HTTP request. Example:
StudentEntity entity= studentRepository.findById(1);//need read-only datasource
entity.setName("David");
entity= studentRepository.save(entity);//need updateable datasource
Could anyone please help me with how can I achieve this? I am struggling for two days.