0
如何在web.xml中的泽西2.22.1中配置声明式绑定,而无需使用Application基类并以编程方式注册它?如何在web.xml中的泽西2.22.1中配置声明式链接绑定?
如何在web.xml中的泽西2.22.1中配置声明式绑定,而无需使用Application基类并以编程方式注册它?如何在web.xml中的泽西2.22.1中配置声明式链接绑定?
您可以声明<init-param>
来注册特定的(以逗号分隔的)资源/提供者/特征。例如
<init-param>
<param-name>jersey.config.server.provider.classnames</param-name>
<param-value>
org.foo.myresources.MyDogResource,
org.glassfish.jersey.linking.DeclarativeLinkingFeature
</param-value>
</init-param>
另外一点需要注意的是,相当多的东西,你可以在ResourceConfig
配置,你还可以配置在Feature
。例如
@Provider
public class MyFeature implements Feature {
@Override
public boolean configure(FeatureContext context) {
context.register(DeclarativeLinkingFeature.class);
}
}
这样的@Provider
进行扫描,当你包扫描,并且将注册功能。