Fix Formatting
This commit is contained in:
@@ -6,11 +6,12 @@ import org.springframework.security.web.csrf.CsrfToken;
|
||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
|
||||
|
||||
@ControllerAdvice
|
||||
public class CsrfAdvice {
|
||||
|
||||
@ModelAttribute
|
||||
public void writeHeader(CsrfToken token, HttpServletResponse response) {
|
||||
response.addHeader(token.getHeaderName(), token.getToken());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,5 +9,5 @@ public class DataRuntimeHintsRegistrar implements RuntimeHintsRegistrar {
|
||||
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
|
||||
hints.resources().registerPattern("import.sql");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -47,14 +47,14 @@ public class MessageController {
|
||||
|
||||
@PutMapping("/{id}")
|
||||
Optional<Message> updateMessage(@PathVariable("id") Long id, @RequestBody String text) {
|
||||
return this.messages.findById(id)
|
||||
.map((message) -> {
|
||||
message.setText(text);
|
||||
// unwrap authorization proxy so Spring Data can persist
|
||||
if (message instanceof AuthorizationProxy proxy) {
|
||||
message = (Message) proxy.toAuthorizedTarget();
|
||||
}
|
||||
return this.messages.save(message);
|
||||
});
|
||||
return this.messages.findById(id).map((message) -> {
|
||||
message.setText(text);
|
||||
// unwrap authorization proxy so Spring Data can persist
|
||||
if (message instanceof AuthorizationProxy proxy) {
|
||||
message = (Message) proxy.toAuthorizedTarget();
|
||||
}
|
||||
return this.messages.save(message);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user