Skip to content

[Java][resteasy] support javax injection instead of static delegate factory#5272

Merged
wing328 merged 2 commits intoswagger-api:masterfrom
chameleon82:issue-3930-resteasy-javax-injection
Dec 11, 2017
Merged

[Java][resteasy] support javax injection instead of static delegate factory#5272
wing328 merged 2 commits intoswagger-api:masterfrom
chameleon82:issue-3930-resteasy-javax-injection

Conversation

@chameleon82
Copy link
Copy Markdown
Contributor

PR for #1686 issue.

Other changes:

  • resteasy-jackson2-provider now provided instead of compile.

Testing issue: Cause this module generates war for Wildfly9/10 (JaxRS2.0), did we need to test it with this environments in ci tests instead of tests with jetty?

@wing328
Copy link
Copy Markdown
Contributor

wing328 commented Apr 6, 2017

Testing issue: Cause this module generates war for Wildfly9/10 (JaxRS2.0), did we need to test it with this environments in ci tests instead of tests with jetty?

If we can test it in CI, yes please include a test

cc @jfiala

@wing328 wing328 added this to the v2.2.3 milestone Apr 6, 2017
@jfiala
Copy link
Copy Markdown
Contributor

jfiala commented Apr 8, 2017

This looks better than the current implementation, but IMHO there is no need for any delegate pattern here, the class should implement the api interface and all annotations should move into the interface. Pls see how it is done for CXF, I think this way it is easy to use & to understand.

Please see PR #4744, there I prepared this for jaxrs-spec.

@wing328 to get this into master sooner than release 2.3.0 I think it would be better to do a non-breaking implementation in the way to keep the original class and add a new interface with the suffix "Service" (as proposed here) or simply "I".
Then we could implement the interface pattern for jaxrs-spec and resteasy at least.
What do you think?

@chameleon82
Copy link
Copy Markdown
Contributor Author

@jfiala , i see a lot of resteasy framework implementations with duplicated code. Think we need to refactor it. We can move model files and spec and other framework independent files into "spec" subproject and use it as base in other subprojects.
Also, in future we can move all independent options ( such as "swaggerFeaure" ) into "spec" and implements them in each resteasy subproject. In this way we need some instruction to describe how implements all options in right way, and, of course, need writing tests for each implementation.
May be, we should change file structure? For example like this:
/JavaJaxRS/spec/resteasy
/JavaJaxRS/spec/cxf
and extends spec in each realization?
What do you think?

ps: now i will rewrite code for your recomendations and can annotate with deprecation tag interfaces, that will moved into spec.

@wing328
Copy link
Copy Markdown
Contributor

wing328 commented Apr 26, 2017

to get this into master sooner than release 2.3.0 I think it would be better to do a non-breaking implementation in the way to keep the original class and add a new interface with the suffix "Service" (as proposed here) or simply "I".
Then we could implement the interface pattern for jaxrs-spec and resteasy at least.
What do you think?

@jfiala next release is 2.3.0 so I would suggest @chameleon82 to file this breaking changes against 2.3.0 instead if you guys want to see this enhancement in a stable release earlier.

@wing328
Copy link
Copy Markdown
Contributor

wing328 commented Nov 13, 2017

@chameleon82 when you've time, please resolve the merge conflicts and we'll merge it into current master (2.3.0), and mark it as a breaking change.

@chameleon82 chameleon82 force-pushed the issue-3930-resteasy-javax-injection branch from e2d1c12 to 6d26e87 Compare November 14, 2017 17:06
@chameleon82
Copy link
Copy Markdown
Contributor Author

@wing328 resolved. Thanks )

@wing328
Copy link
Copy Markdown
Contributor

wing328 commented Nov 27, 2017

@chameleon82 I tried to merge this PR into master and update the RestEasy petstore samples via ./bin/java-petstore-resteasy-all.sh but CircleCI reports the following errors:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project swagger-jaxrs-resteasy-joda-server: Compilation failure: Compilation failure:
[ERROR] /home/ubuntu/swagger-codegen/samples/server/petstore/jaxrs-resteasy/joda/src/main/java/io/swagger/api/impl/StoreApiServiceImpl.java:[15,32] package javax.enterprise.context does not exist
[ERROR] /home/ubuntu/swagger-codegen/samples/server/petstore/jaxrs-resteasy/joda/src/main/java/io/swagger/api/impl/StoreApiServiceImpl.java:[19,2] cannot find symbol
[ERROR] symbol: class RequestScoped
[ERROR] /home/ubuntu/swagger-codegen/samples/server/petstore/jaxrs-resteasy/joda/src/main/java/io/swagger/api/impl/UserApiServiceImpl.java:[15,32] package javax.enterprise.context does not exist
[ERROR] /home/ubuntu/swagger-codegen/samples/server/petstore/jaxrs-resteasy/joda/src/main/java/io/swagger/api/impl/UserApiServiceImpl.java:[19,2] cannot find symbol
[ERROR] symbol: class RequestScoped
[ERROR] /home/ubuntu/swagger-codegen/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/io/swagger/api/UserApi.java:[22,20] package javax.inject does not exist
[ERROR] /home/ubuntu/swagger-codegen/samples/server/petstore/jaxrs-resteasy/joda/src/main/java/io/swagger/api/impl/PetApiServiceImpl.java:[17,32] package javax.enterprise.context does not exist
[ERROR] /home/ubuntu/swagger-codegen/samples/server/petstore/jaxrs-resteasy/joda/src/main/java/io/swagger/api/impl/PetApiServiceImpl.java:[21,2] cannot find symbol
[ERROR] symbol: class RequestScoped
[ERROR] /home/ubuntu/swagger-codegen/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/io/swagger/api/PetApi.java:[23,20] package javax.inject does not exist
[ERROR] /home/ubuntu/swagger-codegen/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/io/swagger/api/StoreApi.java:[22,20] package javax.inject does not exist
[ERROR] /home/ubuntu/swagger-codegen/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/io/swagger/api/UserApi.java:[33,5] cannot find symbol
[ERROR] symbol:   class Inject
[ERROR] location: class io.swagger.api.UserApi
[ERROR] /home/ubuntu/swagger-codegen/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/io/swagger/api/PetApi.java:[35,5] cannot find symbol
[ERROR] symbol:   class Inject
[ERROR] location: class io.swagger.api.PetApi
[ERROR] /home/ubuntu/swagger-codegen/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/io/swagger/api/StoreApi.java:[33,5] cannot find symbol
[ERROR] symbol:   class Inject
[ERROR] location: class io.swagger.api.StoreApi

Ref: https://circleci.com/gh/swagger-api/swagger-codegen/2781

I wonder if you can take a look when you've time.

@chameleon82
Copy link
Copy Markdown
Contributor Author

@wing328 updated. Maven file can`t be overwritten when regenerate example. Fixed with deleting it before regeneration. I will discover how to fix it in future with unbreaking.

@wing328
Copy link
Copy Markdown
Contributor

wing328 commented Dec 11, 2017

@chameleon82 all CI tests passed 👍

Thanks for the PR.

@wing328 wing328 merged commit 643ef64 into swagger-api:master Dec 11, 2017
@wing328 wing328 changed the title resteasy support javax injection instead of static delegate factory [Java][resteasy] support javax injection instead of static delegate factory Dec 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants