-
Notifications
You must be signed in to change notification settings - Fork 2.3k
@PreDestroy not invoked on root resource #2254
Comments
Reported by spamdaemon |
spamdaemon said:
|
spamdaemon said: |
spamdaemon said: |
spamdaemon said: |
spamdaemon said: After seriously searching I've realized this can no longer be done without relying on Jersey. The way to do this seems to be as described here: http://comments.gmane.org/gmane.comp.java.jersey.user/3087 |
mfuksa said: Check the org.glassfish.jersey.server.CloseableService. You can inject it to your resource method, resource or provider using @context annotation and then register your Closeable (using add() method) which will be called when request is finished. |
spamdaemon said: At any rate, I did indeed go the route with the cleanup handler. |
mfuksa said: Note: when implementing please make sure to handle correctly singleton and request scopes. |
stephan202 said: |
stephan202 said: Tangentially related is the fact that the jersey-test-framework-provider-inmemory doesn't support @PreDestroy at all (while the Jetty and Grizzly providers do). Not a deal breaker, but unfortunate. |
This issue was imported from java.net JIRA JERSEY-1982 |
It seems that Jersey 2 no longer invokes @PreDestroy on a root resource when used with the JDK's bundled http server (JdkHttpServerFactory). @PostConstruct is properly as expected.
This was working as expected in Jersey 1.x. Is this no longer the case? Is there a work-around?
Affected Versions
[2.0]
The text was updated successfully, but these errors were encountered: