Therefore, I need to set the timeout parameter for the @Transactional annotation. This property will be obtained from the properties file, which I cannot do, since I meet "The value of the Transactional.timeout annotation attribute must be a constant expression." Something like that
@Value("${mytimeout}")
private int myTimeout;
@Transactional(timeout=myTimeout)
public void myMethod(){
}
The only time a timeout attribute can be set by a variable is when the final variable.
So, I was thinking whether it is possible to programmatically set the timeout property when using the @Transaction annotation. Or in any other way I can set this attribute Thanks!
source
share