chore: use constructor instead of field dependency injection

This commit is contained in:
Nanne Baars 2023-02-16 14:11:59 +00:00
parent b68adfbc7c
commit 73b8c431fc

View File

@ -23,7 +23,7 @@
package org.owasp.webgoat.lessons.xxe; package org.owasp.webgoat.lessons.xxe;
import java.util.Collection; import java.util.Collection;
import org.springframework.beans.factory.annotation.Autowired; import lombok.AllArgsConstructor;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@ -36,9 +36,10 @@ import org.springframework.web.bind.annotation.RestController;
*/ */
@RestController @RestController
@RequestMapping("xxe/comments") @RequestMapping("xxe/comments")
@AllArgsConstructor
public class CommentsEndpoint { public class CommentsEndpoint {
@Autowired private CommentsCache comments; private final CommentsCache comments;
@GetMapping(produces = MediaType.APPLICATION_JSON_VALUE) @GetMapping(produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody @ResponseBody