[JAVA-10500] Investigate and reduce springdoc build time

This commit is contained in:
Haroon Khan
2022-03-19 18:27:30 +00:00
parent ac99726577
commit 10bde9d0af
6 changed files with 66 additions and 109 deletions
@@ -40,7 +40,8 @@ public class FooController {
public ResponseEntity<Foo> getFooById(@PathVariable("id") Long id) {
Optional<Foo> foo = repository.findById(id);
return foo.isPresent() ? new ResponseEntity<>(foo.get(), HttpStatus.OK) : new ResponseEntity<>(HttpStatus.NOT_FOUND);
return foo.map(value -> new ResponseEntity<>(value, HttpStatus.OK))
.orElseGet(() -> new ResponseEntity<>(HttpStatus.NOT_FOUND));
}
@PostMapping
@@ -70,7 +71,7 @@ public class FooController {
@PutMapping("/{id}")
public ResponseEntity<Foo> updateFoo(@PathVariable("id") long id, @RequestBody Foo foo) {
boolean isFooPresent = repository.existsById(Long.valueOf(id));
boolean isFooPresent = repository.existsById(id);
if (!isFooPresent) {
return new ResponseEntity<>(HttpStatus.NOT_FOUND);