我有一个rest get API,当我调用消耗的API获取实体以及在其中使用API时,我的另一个应用程序正在消耗该API
路径为[/ localdeal]的上下文中servlet [dispatcherServlet]的Servlet.service()引发异常[请求处理失败;嵌套的异常是org.springframework.web.client.HttpClientErrorException $ Unauthorized:401 Unauthorized:[
]]与根本原因
org.springframework.web.client.HttpClientErrorException $未经授权:401未经授权:[
它对多个匹配都很有用,任何建议为什么
@PostMapping(value = "/psRequestController")
public ResponseEntity<Map<String, Object>> getAllLocationByUser(
@RequestBody UserLookupInformation userLookupInformation) {
Map<String, Object> result = new HashMap<String, Object>();
ResponseEntity<FinancialTx[]> response =
restTemplate.getForEntity(
userFxRequestUrl + userLookupInformation.getUserEmail(),
FinancialTx[].class);
List<VendorDto> vendors =
vendorService.getAllLocationByLocationAndUserValidation(
userLookupInformation.getLatitude(), userLookupInformation.getLongitude());
FinancialTx[] financialTx = response.getBody();
if (financialTx.length >= 1 && financialTx.length != 0 && vendors.size() > 0) {
return new ResponseEntity(vendors, HttpStatus.OK);
} else if (vendors.size() <= 0 && financialTx.length >= 1) {
result.put(
"message",
"Oops! Looks like there is no deal available from any nearby vendor.");
return ResponseEntity.status(NO_LOCAL_DEAL_FOUND).body(result);
}
result.put(
"message",
"Sorry! You need to have an active parking session in the last "
+ psValidationDays
+ " days to access deals from nearby vendors.");
return ResponseEntity.status(NO_PARKING_SESSION_FOUND).body(result);
}