What are the most common errors when developing Spring applications?

I am currently preparing a bachelor's degree at the University of Münster. I plan to automatically identify common problems in Spring configurations. There are many tools on the market that perform static code analysis to find errors or problems. Obviously, they cannot detect problems that appear only at runtime. I am going to analyze the ApplicationContext of a Spring application and find the wrong configuration using reflection and analysis of the bean graph.

Example: A simple example: if someone wants to make a transaction of a class or method safe using annotations. Usually it adds the @Transactional tag above the class or method, but if the application is not configured correctly and there is no transaction manager registered in the ApplicationContext that marks annotations, then the tag will be ignored. There will be no error message, which is why these problems are difficult to find so far.

Question: What are the most common errors or architectural errors caused by incorrect configuration using Spring mechanisms that can be detected by dynamic analysis? Are there any projects that will help do something like this?

PS In the course of my dissertation, I will develop a prototype that can further detect these problems with open source. :)

+4
source share
1 answer

From Spring related questions, I have answerd your example (not properly initialized @Transaction) is one of the most frequently asked problems. But with a little tweek: Often the problem is that someone is trying to do this:

@Service public class SomeService() { @Transaction public void save(Some thing) { ... } public void doSomeThing(Some thing) { ... this.save(thing); } } 

And then they wonder why the @Transactional annotation @Transactional not taken into account when using doSomeThing .

The problem is that this only works with this real AspectJ and not with this AOP proxy.

0
source

Source: https://habr.com/ru/post/1482197/


All Articles