-
Notifications
You must be signed in to change notification settings - Fork 55
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
Spring upgrade to 3.3.6 #8325
Spring upgrade to 3.3.6 #8325
Conversation
|
||
@Slf4j | ||
class DateTimeScalarCoercion implements Coercing<Date, Object> { | ||
public class DateTimeScalarCoercion implements Coercing<Date, Object> { |
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.
Class and methods were made public for unit testing, similar to FlexibleDateCoercion.java, which also implements Coercing.
@NotNull Object dataFetcherResult, | ||
@NotNull GraphQLContext graphQLContext, | ||
@NotNull Locale locale) | ||
throws CoercingSerializeException { |
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.
Previous overridden method signature was deprecated in favor of 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.
Question for my own understanding... (I have never upgraded Spring before 😅) How did you know this method should now look like this? Was it trial and error or is there some resource you are taking this from? 🤔 This question applies in general for the overridden methods that changed 👀
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.
IIRC, I was mainly alerted through Intellij after updating the dependency related to the change. e.g. after updating the dependency but before updating the code, it looked like this:
So then after seeing that, I'd look into the Coercing interface for what should replace it. Luckily there are usually replacements for deprecated methods and they're not just wiped out entirely.
Another Intellij trick is to right click on the root folder, then Analyze -> Run Inspection by Name
and type in "deprecated" and then click on the one for Java:
Then it'll show you anything that's deprecated or that altogether doesn't work anymore 🧐
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.
Thank you for the detailed explanation and going over this in eng sync as well 🙌
if (((String) input).length() == 0) { | ||
public Date parseValue( | ||
@NotNull Object input, @NotNull GraphQLContext graphQLContext, @NotNull Locale locale) | ||
throws CoercingParseValueException { |
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.
Previous overridden method signature was deprecated in favor of this.
@NotNull CoercedVariables coercedVariables, | ||
@NotNull GraphQLContext graphQLContext, | ||
@NotNull Locale locale) | ||
throws CoercingParseLiteralException { |
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.
Previous overridden method signature was deprecated in favor of this.
public Object serialize( | ||
@NotNull Object dataFetcherResult, | ||
@NotNull GraphQLContext graphQLContext, | ||
@NotNull Locale locale) { |
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.
Previous overridden method signature was deprecated in favor of this.
@@ -45,7 +53,8 @@ public Object serialize(Object dataFetcherResult) { | |||
} | |||
|
|||
@Override | |||
public Object parseValue(Object input) { | |||
public Object parseValue( | |||
@NotNull Object input, @NotNull GraphQLContext graphQLContext, @NotNull Locale locale) { |
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.
Previous overridden method signature was deprecated in favor of this.
@NotNull Value<?> input, | ||
@NotNull CoercedVariables coercedVariables, | ||
@NotNull GraphQLContext graphQLContext, | ||
@NotNull Locale locale) { |
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.
Previous overridden method signature was deprecated in favor of this.
@@ -21,6 +21,10 @@ public boolean isDeleted() { | |||
return isDeleted; | |||
} | |||
|
|||
public boolean getIsDeleted() { | |||
return isDeleted; | |||
} |
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.
This getter is needed in order for GraphQL introspection to work properly or else startup fails. It seems to be looking for a method with "get" in the name.
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.
Is this something that would be helpful to add a comment about in the code? 🤔
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.
Good call! We wouldn't want somebody seeing there are two getters and deleting this one.
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 not rename the method in Eternal.java
to avoid having two getters?
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.
Thanks for calling that out, I'll add that now
@@ -31,11 +32,11 @@ | |||
@Component | |||
@Slf4j | |||
@RequiredArgsConstructor | |||
public class AuditLoggingInstrumentation extends SimpleInstrumentation { | |||
public class AuditLoggingInstrumentation extends SimplePerformantInstrumentation { |
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.
SimpleInstrumentation
is deprecated in favor of SimplePerformantInstrumentation
.
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.
good to know it is performant now
@@ -406,7 +406,7 @@ void requiresPermissionAddPatientsToFacility() throws IOException { | |||
CompletableFuture<Set<Person>> futurePatients = | |||
this._service.savePatients(content, secondFacilityId); | |||
ExecutionException caught = assertThrows(ExecutionException.class, futurePatients::get); | |||
assertThat(caught.getCause().getClass()).isEqualTo(AccessDeniedException.class); | |||
assertThat(caught.getCause().getClass()).isEqualTo(AuthorizationDeniedException.class); |
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.
AccessDeniedException
deprecated in favor of AuthorizationDeniedException
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.
Thanks for calling this out! I'm definitely making use of this in one of my PRs so if this goes in I'll update my usage as well!
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.
Great work on this upgrade David!
33fff01
Quality Gate passedIssues Measures |
BACKEND PULL REQUEST
Related Issue
Changes Proposed
isDeleted
field in EternalAuditedEntity that starts withget
in order for GraphQL introspection from the Spring GraphQL dependency to succeedAdditional Information
Testing
Checklist for Primary Reviewer
test
,dev
, orpentest
and smoke tested