当前位置:网站首页>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){
...
}
边栏推荐
- Install pytorch through pip to solve the problem that torch cannot be used in jupyter notebook (modulenotfoundererror:no module named 'Torch').
- Reading and writing of nodejs excel (.Xlsx) files
- Multithreading and thread pool
- Interface learning
- Native JS high risk reminder pop-up code snippet, "are you sure you want to do this?" and "it cannot be recovered after deletion. Do you want to continue“
- Analysis of IM project framework
- Stack and Queue
- Go Context - Cancelation and Propagation
- MySQL prevents Chinese garbled code and solves the problem of Chinese garbled code
- Page electronic clock (use js to dynamically obtain time display)
猜你喜欢

Five simple data types of JS

Timed thread pool

渗透测试-提权专题

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

BUUCTF(web:1-50)

3.2.3 use tcpdump to observe TCP header information (supplement common knowledge of TCP protocol)

1.5.3 use tcpdump to observe ARP communication process

05 virtual machine stack
![[relax's law of life lying on the square] those poisonous chicken soup that seem to be too light and too heavy, but think carefully and fear](/img/12/d41f8d5abcb61d2632a8b117bf1604.jpg)
[relax's law of life lying on the square] those poisonous chicken soup that seem to be too light and too heavy, but think carefully and fear

Install pytorch through pip to solve the problem that torch cannot be used in jupyter notebook (modulenotfoundererror:no module named 'Torch').
随机推荐
CVPR2021-Semi-supervised Domain Adaptation based on Dual-level Domain Mixing for Semantic Segmentati
Monkey test of APP automation
[day40 literature extensive reading] space and time in the child's mind: metallic or atomic
Go Basics
Professional things use professional people
Page electronic clock (use js to dynamically obtain time display)
How to add an external header file in vs?
Electronic Society C language level 1 28, character diamond
Array: force deduction dichotomy
Object creation and invocation code example
渗透测试-提权专题
"APEC industry +" biov Tech talks about the cross-border of Chinese biotechnology enterprises and "Pratt & Whitney Kangyu" | apec-hub public welfare
Pointer array function combination in C language
A method of automatic continuation of previous tables in word table
ERDAS 9.2 installation tutorial
Go Context - Cancelation and Propagation
Click to jump out and drag the pop-up window
Timed thread pool
[QT] for multithreaded programs, do not use the printf() function to print out
Volatile and JMM memory models