I assume that you do not have ResourceConfig , since you do not seem to know how to use it. Firstly, this is not required. If you use it, it should be a separate class. There you can register a card.
public class AppConfig extends ResourceConfig { public AppConfig() { register(new MyProvider()); } }
But you are probably using web.xml. In this case, you can register a provider with the following <init-param>
<servlet> <servlet-name>MyApplication</servlet-name> <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class> <init-param> <param-name>jersey.config.server.provider.classnames</param-name> <param-value> org.foo.providers.MyProvider </param-value> </init-param> </servlet>
See “Deploying Applications and Runtimes” for more information on the various deployment models. There are several ways to deploy applications. You can even mix and match (web.xml and ResourceConfig).
source share