On Aug 11, 2010, at 9:44 PM, Christian Helmbold wrote:
> The autoscan for resource classes works fine as long as I don't
> specify my own
> JAX-RS application class in the web.xml. Then I have to list all the
> class
> manually in the class. But I want only perform some initialisation
> in the
> constructor.
>
> How can I use the autoscan AND provider my own Application class?
>
Your application can extend from PackagesResourceConfig.
https://jersey.dev.java.net/nonav/apidocs/latest/jersey/com/sun/jersey/api/core/PackagesResourceConfig.html
If you do something like this:
public class MyApp extends PackagesResourceConfig {
public MyApp(Map<String, String> props) {
super(props);
...
}
}
then the init params defined in the web.xml will be taken into
account. Otherwise you can choose to declare the package names using
the other constructor.
Paul.