Can Annotated Tractional attributes be changed in Spring through Java reflection?

StackOverflow https://stackoverflow.com/questions/8306797

  •  25-10-2019
  •  | 
  •  

سؤال

I would like to change the Transaction attributes (especially the TransactionManager ) during runtime via reflection. Is this possible?

eg: @Transactional('ChangeMe')

هل كانت مفيدة؟

المحلول

As fare as I know, Java has no function to modify the annotations at runtime.

But you can use programmatic transaction management, instead of the annotation.

On the other hand you can try to modify springs declarative transaction management, to enable and disable the transactions by some List or Map, but not by reflection.

Additional references:

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top