Removed unused default

This commit is contained in:
Michael Minella
2016-07-06 15:52:21 -05:00
parent 57e9d4dcae
commit 7f1ece96e6
3 changed files with 9 additions and 26 deletions

View File

@@ -20,12 +20,10 @@ import java.util.Map;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.deployer.resource.maven.MavenProperties;
import org.springframework.cloud.deployer.resource.maven.MavenResourceLoader;
import org.springframework.cloud.deployer.resource.support.DelegatingResourceLoader;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ResourceLoader;
@@ -65,18 +63,4 @@ public class ResourceLoadingAutoConfiguration {
@ConfigurationProperties(prefix = "maven")
public static class MavenConfigurationProperties extends MavenProperties {}
}
@Configuration
@ConditionalOnMissingClass("org.springframework.cloud.deployer.resource.maven.MavenResourceLoader")
public static class LocalResourceLoadingAutoConfiguration {
@Bean
@ConditionalOnMissingBean
public DelegatingResourceLoader delegatingResourceLoader(ApplicationContext context) {
Map<String, ResourceLoader> loaders = new HashMap<>(1);
loaders.put("file", context);
return new DelegatingResourceLoader(loaders);
}
}
}

View File

@@ -27,7 +27,6 @@ import org.springframework.batch.core.configuration.annotation.StepBuilderFactor
import org.springframework.batch.core.configuration.annotation.StepScope;
import org.springframework.batch.core.explore.JobExplorer;
import org.springframework.batch.core.explore.support.JobExplorerFactoryBean;
import org.springframework.batch.core.explore.support.SimpleJobExplorer;
import org.springframework.batch.core.partition.PartitionHandler;
import org.springframework.batch.core.partition.support.Partitioner;
import org.springframework.batch.core.repository.JobRepository;
@@ -37,8 +36,6 @@ import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.repeat.RepeatStatus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.deployer.resource.maven.MavenResource;
import org.springframework.cloud.deployer.resource.support.DelegatingResourceLoader;
import org.springframework.cloud.deployer.spi.local.LocalDeployerProperties;
import org.springframework.cloud.deployer.spi.local.LocalTaskLauncher;
import org.springframework.cloud.deployer.spi.task.TaskLauncher;
@@ -49,6 +46,7 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceLoader;
/**
* @author Michael Minella
@@ -72,7 +70,7 @@ public class JobConfiguration {
private ConfigurableApplicationContext context;
@Autowired
private DelegatingResourceLoader delegatingResourceLoader;
private ResourceLoader resourceLoader;
private static final int GRID_SIZE = 4;
@@ -96,7 +94,7 @@ public class JobConfiguration {
@Bean
public PartitionHandler partitionHandler(TaskLauncher taskLauncher, JobExplorer jobExplorer) throws Exception {
Resource resource = delegatingResourceLoader.getResource("maven://io.spring.cloud:partitioned-batch-job:1.0.1.BUILD-SNAPSHOT");
Resource resource = resourceLoader.getResource("maven://io.spring.cloud:partitioned-batch-job:1.0.1.BUILD-SNAPSHOT");
DeployerPartitionHandler partitionHandler = new DeployerPartitionHandler(taskLauncher, jobExplorer, resource, "workerStep");

View File

@@ -18,14 +18,15 @@ package org.springframework.cloud.task.launcher;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.deployer.resource.support.DelegatingResourceLoader;
import org.springframework.cloud.deployer.spi.core.AppDefinition;
import org.springframework.cloud.deployer.spi.core.AppDeploymentRequest;
import org.springframework.cloud.deployer.spi.task.TaskLauncher;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.messaging.Sink;
import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceLoader;
import org.springframework.integration.annotation.ServiceActivator;
import org.springframework.util.Assert;
@@ -45,7 +46,7 @@ public class TaskLauncherSink {
public TaskLauncher taskLauncher;
@Autowired
private DelegatingResourceLoader delegatingResourceLoader;
private ResourceLoader resourceLoader;
/**
* Launches a task upon the receipt of a valid TaskLaunchRequest.
@@ -58,12 +59,12 @@ public class TaskLauncherSink {
}
private void launchTask(TaskLaunchRequest taskLaunchRequest) {
Assert.notNull(taskLauncher, "TaskLauncher has not been initialized");
Assert.notNull(this.taskLauncher, "TaskLauncher has not been initialized");
logger.info("Launching Task for the following resource " + taskLaunchRequest);
Resource resource = delegatingResourceLoader.getResource(taskLaunchRequest.getUri());
Resource resource = this.resourceLoader.getResource(taskLaunchRequest.getUri());
AppDefinition definition = new AppDefinition("Task-" + taskLaunchRequest.hashCode(), taskLaunchRequest.getEnvironmentProperties());
AppDeploymentRequest request = new AppDeploymentRequest(definition, resource, taskLaunchRequest.getDeploymentProperties(), taskLaunchRequest.getCommandlineArguments());
taskLauncher.launch(request);
this.taskLauncher.launch(request);
}
}