Skip to content
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

Upgrade to Spring Boot 3 #2072

Merged
merged 4 commits into from
Dec 7, 2023
Merged

Upgrade to Spring Boot 3 #2072

merged 4 commits into from
Dec 7, 2023

Conversation

vy
Copy link
Member

@vy vy commented Dec 6, 2023

This PR ports log4j-spring-cloud-config-client changes from 2.x (#2018) and upgrades to Spring Boot 3.

@vy vy self-assigned this Dec 6, 2023
@vy vy added this to the 3.0.0 milestone Dec 6, 2023
@rgoers
Copy link
Member

rgoers commented Dec 6, 2023

This looks good to me.

Copy link
Contributor

@ppkarwasz ppkarwasz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not entirely sure about the usage of Simple-JNDI:

  • the author still answered some issue reports last March,
  • but the project didn't have any release since 2020 and its dependencies are from 2016 (commons-io has even a CVE).

MemoryContext could be easily replaced with NamingContext for Apache Tomcat. The only difference with the latter is that it requires an explicit createSubcontext to create missing subcontexts.

Comment on lines +202 to +204
public Context getContext() {
return context;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have mixed feeling about exposing Context (which is usually InitialContext, the source of all evil) from the public API.

Comment on lines +50 to +51
final InitialContextFactoryBuilder factoryBuilder =
factoryBuilderEnv -> factoryEnv -> new MemoryContext(new Hashtable<>()) {};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not storing this MemoryContext somewhere?

The NamingManager.setInitialContextFactoryBuilder method is irreversible (can be called only once), so the context used by JndiManager.getDefaultManager() will always be the one defined in here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Context is closeable, and if the underlying implementation doesn't support re-use after close (as a matter of fact MemoryContext indeed doesn't support reuse), you need a new context at every request.

As a side note, I actually tried reusing it, though bumped into several blockers.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does anything actually call Context#close()?

I would prefer to overcome the blockers than expose an "unsafe" JndiManager.getContext() method that exposes exactly the dangerous object that JndiManager was conceived to wrap.

@vy
Copy link
Member Author

vy commented Dec 7, 2023

@ppkarwasz, I am not strongly opinionated about simple-jndi. It is what Spring Framework recommends as a successor and uses itself too.

Comment on lines +121 to +126
private void addBindings(final Context context) throws NamingException {
for (final Map.Entry<String, Object> entry : bindings.entrySet()) {
final String name = entry.getKey();
final Object object = entry.getValue();
context.bind(name, object);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comparing this method to #2071 I see a potential problem: a bind for foo/bar will fail if there is no context bound to foo. Maybe this method should also call context.createSubcontext for all subcontexts that do not exist?

@ppkarwasz
Copy link
Contributor

@ppkarwasz, I am not strongly opinionated about simple-jndi. It is what Spring Framework recommends as a successor and uses itself too.

If Spring recommends it, it is good enough for me.

@vy
Copy link
Member Author

vy commented Dec 7, 2023

We had a discussion with @ppkarwasz and we decided to address his concerns after merging this PR.

@vy vy merged commit a6954de into main Dec 7, 2023
9 checks passed
@vy vy deleted the main-spring-cloud-revamp branch December 7, 2023 12:48
@ppkarwasz ppkarwasz modified the milestones: 3.0.0, 3.0.0-beta1 Feb 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants