-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Support java modules for azure-spring-data-cosmos #14636
Support java modules for azure-spring-data-cosmos #14636
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good to me. @srnagar - can you please verify this PR to make sure spring-data-cosmos-core is now complying with java 11 support?
@@ -32,7 +32,7 @@ | |||
exports com.azure.cosmos.util; | |||
|
|||
// exporting some packages specifically for Jackson | |||
opens com.azure.cosmos to com.fasterxml.jackson.databind; | |||
opens com.azure.cosmos to com.fasterxml.jackson.databind, org.apache.commons.lang3; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use reflection to retrieve userAgentSuffix
field of cosmosClient: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/cosmos/azure-spring-data-cosmos-core/src/main/java/com/azure/spring/data/cosmos/CosmosFactory.java#L87
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But that code piece is in spring-data-cosmos-core and here we are exporting apache commons lang 3 to azure-cosmos module, which doesn't use this dependency at all. Let's discuss this offline today.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, cosmos package should have no dependency or reference to org.apache.commons.lang3
.
sdk/cosmos/azure-spring-data-cosmos-core/src/main/java/module-info.java
Outdated
Show resolved
Hide resolved
/azp run java - cosmos - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @saragluna
@srnagar - can you please confirm these changes ?
Support Java modules for azure-spring-data-cosmos: #14378.
module-info.java added to the core project azure-spring-data-cosmos-core and the name for this core module is
com.azure.spring.data.cosmos
.For the two pom file projects,
azure-spring-data-2-3-cosmos
andazure-spring-data-2-2-cosmos
, anAutomatic-Module-Name
entry added to themaven-jar-plugin
so these two could be automatic modules when used in Java modules. If we don't add such entry, the automatic module names for these two are likeazure.spring.data.2.2.cosmos
which is not valid and will cause runtime exceptions.We could choose to add
module-info.java
for theazure-spring-data-2-3-cosmos
, but themaven-compiler-plugin
would fail when it compiles this artifact against Java8, complaining it doesn't support Java module even though we exclude themodule-info.java
in such execution.I also created a WIP PR to the sample project showing the changes users need to include when creating a modular application. Azure-Samples/azure-spring-data-cosmos-java-sql-api-getting-started#2