I dislike any approach which mandates some form of scanning. Scanning a
WAR is a potentially expensive business and can cause significant (and
unacceptable for some users) delay on application start. There needs to
be some mechanism (programmatic, static, whatever) that enables a
developer to tell the container "deploy this and this exactly and don't
do anything else".
I think the current solution isn't far off. A
ServletContainerInitializer can be annotated with @HandlesTypes for
Endpoint and @WebSocketEndpoint. Those that don't want scanning can
disable the SCI and use a ServletContextListener and do things
programmatically via ContainerProvider.getServerContainer().
I have no objection to re-factoring the current solution or even a
complete replacement but I do want to see the capabilities retained to:
- disable class scanning
- explicitly define what is to be deployed with requiring any form of
[jsr356-experts] Re: Server deployment