Skip to content

Avoid JNDI property lookup attempts for invalid JNDI keys [SPR-14518] #19087

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

Closed
spring-projects-issues opened this issue Jul 27, 2016 · 1 comment
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: backported An issue that has been backported to maintenance branches type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Jul 27, 2016

Juergen Hoeller opened SPR-14518 and commented

As indicated by spring-projects/spring-boot#6460, when running in a Servlet environment, Spring tries to resolve property names in JNDI (even if they are typically not actually found there). The performance impact of this has been raised in #18598 already, leading to the introduction of the "spring.jndi.ignore" property in 4.3. However, even with that option around, it still seems wasteful to try a JNDI lookup for property keys which are clearly invalid in JNDI's naming scheme. We should try to bypass JNDI lookups for such keys by default.


Affects: 4.2.7, 4.3.1

Referenced from: commits 328e04f, 7021a4b, 4e94e84

Backported to: 4.2.8

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

As of 4.3.2, JndiPropertySource defensively skips property names containing a colon when in resource-ref mode (which is the default) since they are effectively never valid and will never get prefixed with the intended "java:comp/env" either.

Aside from avoiding misleading warnings in server logs (like on Liberty), this also has a positive performance impact since it cuts the number of JNDI lookup attempts to half (the variants including the default clause will always get skipped, just the regular ones processed).

In non-resource-ref mode, we'll keep processing any given property name in JNDI since it is meant to contain a prefix anyway in that mode.

@spring-projects-issues spring-projects-issues added status: backported An issue that has been backported to maintenance branches type: enhancement A general enhancement in: core Issues in core modules (aop, beans, core, context, expression) labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 4.3.2 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: backported An issue that has been backported to maintenance branches type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants