question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`@ConditionalOnProperty` target property with no metadata

See original GitHub issue

Several auto-configurations use a condition on a property that has no metadata. As a result, trying to use it to customize the auto-configuration lead to a warning in an IDE.

The report detected the following:

org.springframework.cloud.task.batch.configuration.TaskBatchAutoConfiguration [spring.cloud.task.batch.listener.enable|spring.cloud.task.batch.listener.enabled]
org.springframework.cloud.task.batch.configuration.TaskJobLauncherAutoConfiguration [spring.cloud.task.batch.failOnJobFailure]
org.springframework.cloud.task.batch.listener.BatchEventAutoConfiguration [spring.cloud.task.batch.events.enabled]
org.springframework.cloud.task.batch.listener.BatchEventAutoConfiguration.JobExecutionListenerConfiguration#chunkEventsListener [spring.cloud.task.batch.events.chunk.enabled]
org.springframework.cloud.task.batch.listener.BatchEventAutoConfiguration.JobExecutionListenerConfiguration#itemProcessEventsListener [spring.cloud.task.batch.events.item-process.enabled]
org.springframework.cloud.task.batch.listener.BatchEventAutoConfiguration.JobExecutionListenerConfiguration#itemReadEventsListener [spring.cloud.task.batch.events.item-read.enabled]
org.springframework.cloud.task.batch.listener.BatchEventAutoConfiguration.JobExecutionListenerConfiguration#itemWriteEventsListener [spring.cloud.task.batch.events.item-write.enabled]
org.springframework.cloud.task.batch.listener.BatchEventAutoConfiguration.JobExecutionListenerConfiguration#jobExecutionEventsListener [spring.cloud.task.batch.events.job-execution.enabled]
org.springframework.cloud.task.batch.listener.BatchEventAutoConfiguration.JobExecutionListenerConfiguration#skipEventsListener [spring.cloud.task.batch.events.skip.enabled]
org.springframework.cloud.task.batch.listener.BatchEventAutoConfiguration.JobExecutionListenerConfiguration#stepExecutionEventsListener [spring.cloud.task.batch.events.step-execution.enabled]
org.springframework.cloud.task.configuration.SingleTaskConfiguration [spring.cloud.task.singleInstanceEnabled]
org.springframework.cloud.task.listener.TaskEventAutoConfiguration [spring.cloud.task.events.enabled]  

Also, please note that properties in @ConditionalOnPropety have to be defined with the canonical format (so spring.cloud.task.singleInstanceEnabled must be spring.cloud.task.single-instance-enabled for instance).

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jvalkealcommented, Oct 26, 2018

Thx, good point as I really didn’t get that into my radar!

0reactions
cppwfscommented, Oct 26, 2018

PR created https://github.com/spring-cloud/spring-cloud-task/pull/468. Thanks for catching this!

Read more comments on GitHub >

github_iconTop Results From Across the Web

`@ConditionalOnProperty` target property with no metadata · Issue ...
Several auto-configurations use a condition on a property that has no metadata. As a result, trying to use it to customize the auto-configuration...
Read more >
`@ConditionalOnProperty` target property with no metadata
Several auto-configurations use a condition on a property that has no metadata. As a result, trying to use it to customize the ...
Read more >
ConditionalOnProperty and "defaultValue": true - Stack Overflow
Hm, right, that will solve the issue. But is there any way to specify the default value for the property? If no, I'll...
Read more >
ConditionalOnProperty (Spring Boot Docs 1.3.0.RELEASE API)
Conditional that checks if the specified properties have a specific value. By default the properties must be present in the Environment and not...
Read more >
The Spring @ConditionalOnProperty Annotation - Baeldung
For example, we may want to register a DataSource bean to point to a production or test database depending on if we set...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found