当前位置:网站首页>Feignclient reported an error npe:null
Feignclient reported an error npe:null
2022-06-25 05:38:00 【wisdommee】
FeignClient Report errors NPE:null
I've been writing about spring cloud Micro service project of , An interface was added to the consumer yesterday , The result is wrong NPE, After analysis, it is found that springboot No automatic injection , The following is the analysis and solution of my problem
Error details
java.lang.NullPointerException: null at xxx.loginconsumer.controller.PostLoginController.updateBlockStates(PostLoginController.java:123) ~[classes!/:0.1.9] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_111] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_111] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_111] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_111] at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) ~[spring-web-5.3.12.jar!/:5.3.12] at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:150) ~[spring-web-5.3.12.jar!/:5.3.12] at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117) ~[spring-webmvc-5.3.12.jar!/:5.3.12] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895) ~[spring-webmvc-5.3.12.jar!/:5.3.1
Code details
Controller
@PostMapping(value = "/block-user")
private ResultMessage<String> updateBlockStates(@RequestParam("user_id") String userId, @RequestParam("block") Boolean block){
...
}
Question why
I didn't notice that the method was written by me private 了 , Lead to springboot Unable to inject automatically , Led to NPE
resolvent
take private Change it to public, Perfect solution
@PostMapping(value = "/block-user")
public ResultMessage<String> updateBlockStates(@RequestParam("user_id") String userId, @RequestParam("block") Boolean block){
...
}
边栏推荐
- CopyPlugin Invalid Options options should be array ValidationError: CopyPlugin Invalid Options
- How to install the blue lake plug-in to support Photoshop CC 2017
- 05 virtual machine stack
- MySQL operation JSON
- The k-th node of the binary search tree [sword finger offer]
- [day40 literature extensive reading] space and time in the child's mind: metallic or atomic
- Personalized Federated Learning with Moreau Envelopes
- 1.6.3 use tcpdump to observe DNS communication process
- Create dynamic array
- MySQL -- optimize query statements and use not in with cases
猜你喜欢

Array: force deduction dichotomy

CVPR2021-Semi-supervised Domain Adaptation based on Dual-level Domain Mixing for Semantic Segmentati

"APEC industry +" biov Tech talks about the cross-border of Chinese biotechnology enterprises and "Pratt & Whitney Kangyu" | apec-hub public welfare

By inserting a section break, the word header, footer, and page number can start from any page

Personalized Federated Learning with Moreau Envelopes

JSON Library Tutorial from scratch (II): parsing digital learning and sorting notes

Semantic segmentation cvpr2020 unsupervised intra domain adaptation for semantic segmentation through self supervision

Stack and Queue

Example of dynamic programming 3 leetcode 55

Uva1103 ancient pictograph recognition
随机推荐
The article is on the list. Welcome to learn
MySQL operation JSON
SQL get current time
Learn the interface test, see it is very good, and make a note
Mirror image of binary tree
Essais de pénétration - sujets d'autorisation
Basic bit operation symbols of C language
What happens when you use "-fno exceptions", "new T"- With “-fno-exceptions”, what happens with “new T”?
Deep analysis of recursion in quick sorting
Using JS to realize the sidebar of life information network
Uva1103 ancient pictograph recognition
[Huawei machine test] hj16 shopping list
Example of dynamic programming 3 leetcode 55
Two dimensional array and function call cases of C language
Multithreading and thread pool
For in JS Of and for in
Click to jump out and drag the pop-up window
2021-03-23
Understand JS high-order function and write a high-order function
About the definition of pointer variables (personal notes)