I need to acess the UriInfo from my HttpServlet, but whenever I try to inject it, the object is null.
Is there a way to access it from a HttpServlet? Am I missing something?
I'm already injecting Spring context to enable dependency injection.
But now, I also want to access @Context UriInfo
from Jersey/Jax-rs context, but I can't seem to inject it into my Servlet.
import javax.servlet.http.HttpServlet;@Slf4j@Configurationpublic class CustomServlet extends HttpServlet { @Autowired private OpenApiConfig openApiConfig; @Autowired SwaggerModelConfig swaggerModelConfig; @Context UriInfo uriInfo; @Override public void init(ServletConfig config) throws ServletException { super.init(config); SpringBeanAutowiringSupport.processInjectionBasedOnServletContext(this, config.getServletContext()); } @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { // need to access UriInfo here }}