Inject ResourceConfig instance (not class) into Jersey
If you inject the class (via a servlet parameter) it seems that Jersey tries to create all the beans for you (and fails). I thought it was supposed to work (according to the docs), so I'm a bit confused but the sample now has Spring DI and the tests pass. Fixes gh-1981
This commit is contained in:
@@ -19,19 +19,19 @@ package sample.jersey;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@Path("/hello")
|
||||
public class Endpoint {
|
||||
|
||||
@Value("${message:World}")
|
||||
private String msg;
|
||||
@Autowired
|
||||
private Service service;
|
||||
|
||||
@GET
|
||||
public String message() {
|
||||
return "Hello " + this.msg;
|
||||
return "Hello " + this.service.message();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user