After apply new version 2.4.4 to fix #25262, i've now 404 on endpoint. ok with servlet type
To reproduce :
-
https://start.spring.io/#!type=gradle-project&language=java&platformVersion=2.4.4.RELEASE&packaging=jar&jvmVersion=11&groupId=com.example&artifactId=demo&name=demo&description=Demo%20project%20for%20Spring%20Boot&packageName=com.example.demo&dependencies=lombok,configuration-processor,jersey,actuator,devtools
-
application.properties
spring.jersey.type=filter
- define JerseyConfig
import org.glassfish.jersey.server.ResourceConfig;
import org.springframework.stereotype.Component;
@Component
public class JerseyConfig extends ResourceConfig {
public JerseyConfig() {
register(FeatureController.class);
}
}
- define endpoint
package com.example.demo;
import javax.inject.Named;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
@Named
@Path("/feature")
public class FeatureController {
@GET
public String getFeature() {
return "feature is ok";
}
}
Comment From: wilkinsona
Do you have a servlet configured in your app with a mapping that covers /feature
? Even though the request will be handled by Jersey's filter, the Servlet spec requires a Servlet to be in place at the end of the filter chain. You aren't using Spring MVC so its DispatcherServlet won't be configured. As you're using Spring Boot 2.4, you may need to enable the default servlet.
Comment From: Fyro-Ing
ok, with "server.servlet.register-default-servlet=true" all is good.
So now, with 2.4.x, we need this configuration with jersey configured as filter, this is the expected behavior ?
if yes, i supposed this can be notified on documentation ? https://docs.spring.io/spring-boot/docs/current/reference/html/spring-boot-features.html#boot-features-jersey