How to Solve SSM Error: Request processing failed; nested exceptionis java.lang.NullPointerExceptio

Recently, in Android studio, an app operated by the front desk of a food and beverage management system server, using SSM framework as the server, reported an error as shown in the following figure when the app called the server:

To be exact, one of the most important mistakes is: request processing failed; nested exception

Is java.lang.nullpointerexceptio, which means that the request processing fails, and the nested exception is java.lang.nullpointerexceptio null pointer exception

After some breakpoint troubleshooting, I found that the problem appeared in the implementation interface of service. When the service called the Dao layer, it reported an error. If I think about it in detail, it might be that there was a problem when referring to the Dao layer. Then I went to check the code of the Dao layer and found the problem, It’s obvious from the picture that I omitted the annotation @ Autowired when referring to the Dao layer. Later, I added the annotation and then operated. The problem was solved

terms of settlement:

This time there will be such a problem is completely caused by their own carelessness and carelessness, so we must be careful when writing code, we must be careful to find problems

Finally, let’s popularize the function of @ Autowired

Autowired is the core annotation of spring. It can annotate class member variables, methods and constructors, so that spring can complete the automatic assembly of beans@ Autowired matches beans by class by default, and assembles beans by name according to @ qualifier specification. It is also the automatic assembly of IOC

Similar Posts: