Comments (4)
This is quite similar to #38514 which the underlying cause being the same non-enumerable property source that comes from JNDI being available. You can work around the problem by adding a spring.properties
file to src/main/resources
that contains spring.jndi.ignore=true
.
The failure's occurring because DruidDataSource
isn't entirely compatible with configuration property binding.
When all property sources are enumerable, binding can be optimised to only try to bind properties that are present in the environment. For example, if there are no spring.datasource.log.connection.*
properties in the environment, the binder will never need to call getConnection()
on the DruidDataSource
.
When there's a non-enumerable property source in the environment, the binder does not know all of the properties that are available so it has to try to bind everything. As part of trying to bind everything, the binder's calling getConnection()
so that it can then introspect its result for setter methods and determine which properties need to be bound to it. This call fails as it's happening before the URL had been set. Even if the URL had been set, the call would still be unwanted as it would leak a connection.
Hopefully the workaround above is enough to get you past the problem. I'll leave this open for now as I'm not sure what, if anything, we can do to address it. One option would be to provide a way to indicate properties that should be ignored when binding to a third-party class. Another would be for you to bind properties to a safe class of your own and then use Boot's PropertyMapper
to apply those to the DruidDataSource
instance. Lastly, you could explore binding properties to Boot's DataSourceProperties
class and then building the DataSource
from those properties:
properties.initializeDataSourceBuilder().type(DruidDataSource.class).build();
from spring-boot.
I know it's risky, but can we ignore JndiPropertySource
by default since it's vulnerable and not much useful in practice?
from spring-boot.
I requested Spring Framework team to disable JndiPropertySource
by default. see spring-projects/spring-framework#18598 (comment)
from spring-boot.
We've opened #39932 to deal with the Jetty JNDI issue. Once that has been done this issue is effectively a duplicate of #34616
from spring-boot.
Related Issues (20)
- spring-boot-dependencies cannot be used with repositories that ban com.oracle.database.jdbc:ojdbc-bom
- spring-boot-dependencies cannot be used with repositories that ban com.oracle.database.jdbc:ojdbc-bom
- Upgrade to Asciidoctor Gradle Plugin 4.0.2
- Avoid calling getProject() during execution of StarterMetadata task
- Avoid calling getProject() during execution of StarterMetadata task
- Avoid calling getProject() during execution of StarterMetadata task
- Avoid calling getProject() during execution of AutoConfigurationMetadata task
- Avoid calling getProject() during execution of AutoConfigurationMetadata task
- Avoid calling getProject() during execution of AutoConfigurationMetadata task
- Avoid calling getProject() during execution of publishMavenPublicationToProjectRepository
- Avoid calling getProject() during execution of publishMavenPublicationToProjectRepository
- Avoid calling getProject() during execution of publishMavenPublicationToProjectRepository
- Avoid calling getProject() when checking configuration metadata
- Avoid calling getProject() when checking configuration metadata
- Avoid calling getProject() when checking configuration metadata
- IllegalArgumentException can be thrown when running an uber jar on a shared drive HOT 3
- Avoid calling getProject() during execution of extractVersionConstraints
- Avoid calling getProject() during execution of extractVersionConstraints
- Using prometheus 0.x with distribution percentiles lead to "Counts in ClassicHistogramBuckets cannot be negative."
- LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default' HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spring-boot.