mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-09-20 14:39:36 +00:00
Use constructor injection for Jersey sample
This commit is contained in:
+5
-1
@@ -26,9 +26,13 @@ import org.springframework.stereotype.Component;
|
||||
@Path("/hello")
|
||||
public class Endpoint {
|
||||
|
||||
@Autowired
|
||||
private Service service;
|
||||
|
||||
@Autowired
|
||||
public Endpoint(Service service) {
|
||||
this.service = service;
|
||||
}
|
||||
|
||||
@GET
|
||||
public String message() {
|
||||
return "Hello " + this.service.message();
|
||||
|
||||
Reference in New Issue
Block a user