标签:
return Optional.ofNullable(brokerRepository.findOne(id)) .map(broker -> new ResponseEntity<>( broker, HttpStatus.OK)) .orElse(new ResponseEntity<>(HttpStatus.NOT_FOUND));
spring mvc 使用Optional
原文地址:http://www.cnblogs.com/feika/p/4465530.html