I have a requirement where I need to call a method with transaction propagation level based on the incoming request. Lets request 1 comes for method A with Required_new propogation level where as request2 comes for method A with Required propogation level (propagation level will be decided run time). So there different propgation levels on a single method which will be decided runtime. We are using spring's declarative transaction management with annotation (@transaction (....)). What are the ways to do this.
One of the solutions I am thinking about is to wrap the @Transaction annotation in a custom annotation and call the @transaction with different attributes based on the incoming request. Not sure if this will work as haven't tried yet.
Please let me know if anybody has solution to this.