-
Notifications
You must be signed in to change notification settings - Fork 300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove false positives from Transactional Proxy Rule #1253
Comments
OK, I worked out the solution. The methods in ProxyRules.java should return
This would allow us to apply these methods with methods(). Like this:
I made the changes locally and it worked for me. |
What about this class? public class MyService {
@Transactional
public void a() [
b();
}
private void b() [
c();
}
@Transactional
public void c() [
// ...
}
} Should the method call in Another example from Spring: class MyRepo {
@Cacheable("x")
public String x() [
y();
// ...
}
@Cacheable("y")
public int y() [
// ...
}
} In this case, the method call in I'm not really happy with That's why I started archunit-spring and support for |
I think that the ProxyRule
no_classes_should_directly_call_other_methods_declared_in_the_same_class_that_are_annotated_with(Transactional)
creates false positives. We are checking that no method calls Transactional methods in the same class. However, if the calling method is also Transactional, there is probably no problem. The Transaction is started by the calling method and includes the called method. Thefore, the rule should really be something like:
no_methods_not_annotated_with_should_directly_call_other_methods_declared_in_the_same_class_that_are_annotated_with
Do you agree with my logic?
The text was updated successfully, but these errors were encountered: