mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Use constructor injection for Jersey sample
This commit is contained in:
parent
9f7bd0cddc
commit
f21d58ada7
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user