New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a runtime dependency on javax.annotation:javax.annotation-api for those using Java 9 #9366

Closed
wilkinsona opened this Issue May 31, 2017 · 8 comments

Comments

Projects
None yet
4 participants
@wilkinsona
Member

wilkinsona commented May 31, 2017

When running on Java 9, javax.annotation isn't visible by default as it's in a separate module. It can be made visible by using --add-module java.se.ee but this can cause problems with javax.transaction, a subset of which is in the java.se.ee module.

The symptom of javax.annotation not being on the class path is that @PostConstruct methods are not called. We use it quite a lot in our own auto-configuration so I think we should consider adding javax.annotation:javax.annotation-api to spring-boot-starter or similar.

A complication here is that tomcat-embed-core contains @PostConstruct (and various other javax.annotation packages so we'd end up with duplicate copies of the same classes in the web and tomcat starters. We already have a similar problem with javax.persistence when Tomcat and JPA are used together.

@philwebb

This comment has been minimized.

Member

philwebb commented Jun 2, 2017

Errgh. That Tomcat thing is a bit of pain. I wonder if they would be interested in offering a version of the embedded jar that doesn't contain any javax.* packages?

@wilkinsona wilkinsona self-assigned this Jun 21, 2017

@wilkinsona wilkinsona added this to the 2.0.0.M3 milestone Jun 21, 2017

@wilkinsona wilkinsona changed the title from Consider adding a runtime dependency on javax.annotation:javax.annotation-api for those using Java 9 to Add a runtime dependency on javax.annotation:javax.annotation-api for those using Java 9 Jun 21, 2017

@snicoll snicoll modified the milestones: 2.0.0.M3, 2.0.0.M4 Jul 13, 2017

@wilkinsona wilkinsona removed their assignment Aug 11, 2017

@snicoll

This comment has been minimized.

Member

snicoll commented Aug 16, 2017

@markt-asf do you think the Tomcat team would be interested by that? (see Phil's comment above). Thanks!

@markt-asf

This comment has been minimized.

markt-asf commented Aug 16, 2017

That is unlikely given that that would mean not shipping the Servlet API. (and JASPIC, JSP and WebSocket APIs)
Not packaging the annotations in the core embedded JAR and depending on the standard JAR is more likely.

@snicoll

This comment has been minimized.

Member

snicoll commented Aug 16, 2017

@markt-asf that would work as well. Do you want me to create an issue in bz for this?

@markt-asf

This comment has been minimized.

markt-asf commented Aug 17, 2017

Please.

@snicoll

This comment has been minimized.

Member

snicoll commented Aug 17, 2017

@snicoll

This comment has been minimized.

Member

snicoll commented Sep 6, 2017

@wilkinsona Shouldn't we wait to fix #10133 first?

@wilkinsona

This comment has been minimized.

Member

wilkinsona commented Sep 7, 2017

We could wait, but I don't think we have to. #10133 will just help us tidy things up a bit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment