-
Notifications
You must be signed in to change notification settings - Fork 357
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
chore: upgrade to spring 6 #18314
chore: upgrade to spring 6 #18314
Conversation
@@ -0,0 +1 @@ | |||
ALTER TABLE programruleaction ALTER COLUMN notificationtemplateid TYPE BIGINT; |
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.
new jpa schema validator complain about this column has type integer
in database but long
in Java
</dependency> | ||
<dependency> | ||
<groupId>com.vladmihalcea</groupId> | ||
<artifactId>hibernate-types-52</artifactId> | ||
<version>${hibernate-types.version}</version> |
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.
com.vladmihalcea
is replaced by io.hypersistence
@@ -453,7 +452,7 @@ private void configureCspFilter( | |||
} | |||
|
|||
private void configureCorsFilter(HttpSecurity http) { | |||
http.addFilterBefore(CorsFilter.get(), BasicAuthenticationFilter.class); | |||
http.addFilterBefore(DhisCorsFilter.get(), BasicAuthenticationFilter.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.
Fix below error. Basically Spring 6 complains about our custom object has same name with the default object.
Bean named 'corsFilter' is expected to be of type
'org.springframework.web.filter.CorsFilter' but was actually of type org.hisp.dhis.webapi.filter.CorsFilter
@@ -419,7 +419,6 @@ public <O extends BasicAuthenticationFilter> O postProcess(O filter) { | |||
.and() | |||
//////////////////// | |||
.sessionManagement() | |||
.requireExplicitAuthenticationStrategy(true) |
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.
Fix below error
Caused by: java.lang.IllegalStateException: Invalid configuration that explicitly sets requireExplicitAuthenticationStrategy to true but implicitly requires it due to the following properties being set: [sessionCreationPolicy = ALWAYS, maximumSessions = 10]
at org.spr
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.
Things to look at after merge (team tasks):
- Using
default
implementation of new methods inMessageSender
seems off as their default implementation looks more like a stub - (as discussed) have a look at job execute now (likely simplification is possible now)
@@ -175,6 +175,8 @@ public interface JobConfigurationStore extends GenericDimensionalObjectStore<Job | |||
*/ | |||
boolean tryRevertNow(@Nonnull String jobId); | |||
|
|||
boolean executeNow(@Nonnull String jobId); |
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 should not exist as there is already a method with that exact task (we look at that later)
@@ -287,6 +287,23 @@ public boolean tryExecuteNow(@Nonnull String jobId) { | |||
return nativeSynchronizedQuery(sql).setParameter("id", jobId).executeUpdate() > 0; | |||
} | |||
|
|||
@Override | |||
public boolean executeNow(@Nonnull String jobId) { |
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.
I guess this is a copy of tryExecuteNow
without the @Transactional
annotation which we should try to remove anyhow as we usually don't want them on store level.
|
||
default List<OutboundMessage> getAllMessages() { | ||
return List.of(); | ||
} |
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.
wondering what these new default methods are for? are they used anywhere?
should a MessageSender just send messages, or get messages 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.
i've seen it used in the FakeMessageSender while looking through the rest of the PR. This seems like a code smell if it's only used for tests.
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 is currently a workaround for fixing the issue of overriding a bean in test environment. As @Qualifer
doesn't work for that purpose. I can give an explanation in next week meeting.
Basically in test we have FakeMessageSender
SmsMessageSender
and EmailMessageSender
.
We want the FakeMessageSender
to override both SmsMessageSender
and EmailMessageSender
.
But FakeMessageSender
has specific methods getAllMessages()
, which then can't be casted back to the others messageSenders.
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.
In Spring 5 you can override a bean by declaring same bean name.
But in spring 6, it doesn't work anymore. Need to implement same interface.
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
Quality Gate passedIssues Measures |
Goal
Notes
SocketUtils
is removed from spring utils package. So I copied the class to our project as a temporary solution.org.apache.httpcomponents.client5:httpclient5
Response.getStatusCode()
return the interfaceHttpStatusCode
instead of enumHttpStatus
like before. This breaks many existing codes.WebhookHandler
the methodhttpClient.setTimeOut()
has been removed. Need to replace by settingSocketConfig.setSoTimeout
@EventListener
stop working.MultipartResolver
changed from usingCommonsMultipartResolver
toStandardServletMultipartResolver
(change already included by Viet)FileStoreTest#shouldStoreFileResourceInExternalStore
passing400
with messageRequired part 'file' is not present.
. The servlet could not recognise that there was a file submitted as part of the multipart request.dhis2_home/files/icon
Spring-security changes
builder.clientAuthenticationMethod(ClientAuthenticationMethod.BASIC);
->builder.clientAuthenticationMethod(ClientAuthenticationMethod.CLIENT_SECRET_BASIC);