Skip to content

Commit

Permalink
updated ResponseEntity
Browse files Browse the repository at this point in the history
  • Loading branch information
dschadow committed Dec 14, 2024
1 parent 62097c7 commit 0a10469
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import de.dominikschadow.configclient.credential.CredentialController;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
Expand Down Expand Up @@ -54,10 +53,10 @@ public ResponseEntity<ApplicationInformation> about() {
properties.application().profile());
}

ApplicationInformation info = new ApplicationInformation(about);
var info = new ApplicationInformation(about);
info.add(linkTo(methodOn(AboutController.class).about()).withSelfRel());
info.add(linkTo(methodOn(CredentialController.class).getAllCredentials()).withRel("credentials"));

return new ResponseEntity<>(info, HttpStatus.OK);
return ResponseEntity.ok(info);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import de.dominikschadow.configclient.user.UserRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.data.rest.webmvc.support.RepositoryEntityLinks;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
Expand Down Expand Up @@ -55,11 +54,11 @@ public ResponseEntity<ApplicationInformation> about() {
properties.application().profile());
}

ApplicationInformation info = new ApplicationInformation(about);
var info = new ApplicationInformation(about);
info.add(linkTo(methodOn(AboutController.class).about()).withSelfRel());
info.add(entityLinks.linkToCollectionResource(UserRepository.class));
info.add(entityLinks.linkToCollectionResource(CredentialRepository.class));

return new ResponseEntity<>(info, HttpStatus.OK);
return ResponseEntity.ok(info);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.rest.webmvc.support.RepositoryEntityLinks;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
Expand All @@ -49,11 +48,11 @@ public class AboutController {
*/
@GetMapping(value = "/")
public ResponseEntity<ApplicationInformation> about() {
ApplicationInformation info = new ApplicationInformation(applicationName);
var info = new ApplicationInformation(applicationName);
info.add(linkTo(methodOn(AboutController.class).about()).withSelfRel());
info.add(entityLinks.linkToCollectionResource(UserRepository.class));
info.add(entityLinks.linkToCollectionResource(CredentialRepository.class));

return new ResponseEntity<>(info, HttpStatus.OK);
return ResponseEntity.ok(info);
}
}

0 comments on commit 0a10469

Please sign in to comment.