I wanto set max age in cache control header in respon. I have write this as below, but still has max-age 0. i want to set max age only for one method, so i wantnot to disable default. i thik is should ovveride.
@ApiOperation(value = "get value by foreign currency", response = Property.class)
@RequestMapping(method = RequestMethod.GET, value = "/properties/{id}")
@ResponseBody
public ResponseEntity<BigDecimal> getValueByForeignCurrency(@PathVariable Long id,
@RequestParam("currency") String currency, Locale locale) {
if (!ForeignCurrency.isLegalCurrency(currency)) {
throw new IllegalArgumentException("Currency: " + currency + " is not legal");
}
BigDecimal foreignValue = propertyService.getPropertyValueInForeignCurrency(id, currency, locale);
return ResponseEntity.ok().cacheControl(CacheControl.maxAge(1, TimeUnit.HOURS))
.body(foreignValue);
}
Sombody know what i done wrong ?