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:
- Context initialization failed — solution
- org.springframework.beans.factory.BeanCreationException: Could not autowire field org.springfram… [How to Solve]
- Property ‘dataSource’ threw exception; nested exception is java.lang.NoClassDefFoundError: org/springframework/jdbc/datasource/TransactionAwareDataSourceProxy
- Spring cloud consumer feign injection error [How to Solve]
- [Solved] Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder ‘custom.property.hello’ in value “${custom.property.hello}” config
- [Solved] Import AOP Error: error at ::0 formal unbound in pointcut
- Request processing failed; nested exception is java.lang.NullPointerException
- org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘com.southwind.mmall002.service.Impl.ProductCategoryServiceImplTest’:
- java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
- [Solved] SpringbootExpection 1: Error creating bean with name ‘xxxImpl’: Unsatisfied dependency expressed through field