Updated to add metadata for Conditionals

Also renamed camel-cased properties to cononical format.

resolves #442
This commit is contained in:
Glenn Renfro
2018-10-16 16:38:08 -04:00
committed by Janne Valkealahti
parent c719f8b1f9
commit d2c90c5256
15 changed files with 103 additions and 19 deletions

View File

@@ -39,7 +39,7 @@ import org.springframework.integration.support.leader.LockRegistryLeaderInitiato
import org.springframework.integration.support.locks.LockRegistry;
/**
* When spring.cloud.task.singleInstanceEnabled is set to true this listener will create a lock for the task
* When spring.cloud.task.single-instance-enabled is set to true this listener will create a lock for the task
* based on the spring.cloud.task.name. If a lock already exists this Listener will throw
* a TaskExecutionException. If this listener is added manually, then it should
* be added as the first listener in the chain.

View File

@@ -41,7 +41,7 @@ import org.springframework.util.CollectionUtils;
@Order(Ordered.HIGHEST_PRECEDENCE)
@Configuration
@ConditionalOnProperty(prefix = "spring.cloud.task", name = "singleInstanceEnabled", havingValue = "true")
@ConditionalOnProperty(prefix = "spring.cloud.task", name = "single-instance-enabled", havingValue = "true")
public class SingleTaskConfiguration {
@Autowired

View File

@@ -74,7 +74,7 @@ public class TaskProperties {
/**
* Declares the maximum amount of time (in millis) that a task execution can
* hold a lock to prevent another task from executing with a specific task
* name when the singleInstanceEnabled is set to true. Default time is: Integer.MAX_VALUE.
* name when the single-instance-enabled is set to true. Default time is: Integer.MAX_VALUE.
*/
private int singleInstanceLockTtl = Integer.MAX_VALUE;

View File

@@ -0,0 +1,10 @@
{
"properties": [
{
"defaultValue": "false",
"name": "spring.cloud.task.single-instance-enabled",
"description": "This property is used to determine if a task will execute if another task with the same app name is running.",
"type": "java.lang.Boolean"
}
]
}

View File

@@ -42,7 +42,7 @@ import static org.junit.Assert.assertNotNull;
@RunWith(SpringRunner.class)
@ContextConfiguration(classes = {TaskProperties.class, SimpleTaskConfiguration.class, SingleTaskConfiguration.class})
@TestPropertySource(properties = {
"spring.cloud.task.singleInstanceEnabled=true",
"spring.cloud.task.single-instance-enabled=true",
})
public class SimpleSingleTaskAutoConfigurationTests {
@Autowired

View File

@@ -44,7 +44,7 @@ import static org.junit.Assert.assertNotNull;
SingleTaskConfiguration.class,
EmbeddedDataSourceConfiguration.class})
@TestPropertySource(properties = {
"spring.cloud.task.singleInstanceEnabled=true",
"spring.cloud.task.single-instance-enabled=true",
})
public class SimpleSingleTaskAutoConfigurationWithDataSourceTests {