How to change the @ RequestMapping (value="https://bbs.csdn.net/board") in the path to the board, the new route calls, is to start, is boad path, but after the start, want to change the url path this do? I wrote a, there are still problems, the value changed, but there's no way to load update,
@ RestController
@ RequestMapping ("/test ")
Public class BoardController {
@ RequestMapping (value="https://bbs.csdn.net/board", method={RequestMethod. POST})
Public ApiResult board (@ RequestBody MapParams) throws the Exception {
Return ApiResult. Succ (null);
}
}
//get member methods of class object
Method board=BoardController. Class. GetMethod (the "board", the Map. The class);
//get the Test the annotations on
RequestMapping RequestMapping=board. GetAnnotation (RequestMapping. Class);
//get agent processor
InvocationHandler handler=Proxy. GetInvocationHandler (requestMapping);
//the past private memberValues attribute
The Field f=handler. GetClass (). GetDeclaredField (" memberValues ");
F.s etAccessible (true);
//for instance attributes map
MapMemberValues=(Map ) F.g et (handler);
//modify attribute values
MemberValues. Put (" value ", "/url");
CodePudding user response:
I want to know more, why do you want to do thatCodePudding user response:
Want to write a generic type damper, the performance pressure test, call the service, each time there is a new demand, just change the inside of the configuration file url and return value parameter is ok, other don't need,,CodePudding user response:
Then I suggest you use httpcore or netty, baffle its own HTTP service,While for springmvc merely the start or stop the trigger baffle service interface,
In this way, your own controllable damper service parameters,
CodePudding user response:
Don't change the,,,,CodePudding user response:
Clue, can use @ PathVariableIn the URL path for the response processing parameters,
If the above solution still cannot satisfy the requirement of the building Lord, then, a custom interceptors, intercepts all requests, from the processing,
CodePudding user response: