Remove executable jar from distribution
It doesn't get used much and it has way too many optional dependencies in it now.
This commit is contained in:
@@ -5,9 +5,9 @@ $ cd spring-cloud-config-server
|
||||
$ mvn spring-boot:run
|
||||
----
|
||||
|
||||
The server is a Spring Boot application so you can build the jar file
|
||||
and run that (`java -jar ...`) or pull it down from a Maven
|
||||
repository. Then try it out as a client:
|
||||
The server is a Spring Boot application so you can run it from your
|
||||
IDE instead if you prefer (the main class is
|
||||
`ConfigServerApplication`). Then try it out a client:
|
||||
|
||||
----
|
||||
$ curl localhost:8888/foo/development
|
||||
|
||||
@@ -40,10 +40,10 @@ to use your own `application.properties`, e.g.
|
||||
[source,properties]
|
||||
----
|
||||
server.port: 8888
|
||||
spring.cloud.config.server.git.uri: file://${HOME}/config-repo
|
||||
spring.cloud.config.server.git.uri: file://${user.home}/config-repo
|
||||
----
|
||||
|
||||
where `${HOME}/config-repo` is a git repository containing
|
||||
where `${user.home}/config-repo` is a git repository containing
|
||||
YAML and properties files.
|
||||
|
||||
[TIP]
|
||||
|
||||
@@ -50,11 +50,11 @@
|
||||
<groupId>org.yaml</groupId>
|
||||
<artifactId>snakeyaml</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.tmatesoft.svnkit</groupId>
|
||||
<artifactId>svnkit</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.tmatesoft.svnkit</groupId>
|
||||
<artifactId>svnkit</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
@@ -69,16 +69,4 @@
|
||||
<java.version>1.7</java.version>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<classifier>exec</classifier>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -10,8 +10,8 @@ import org.springframework.context.annotation.Configuration;
|
||||
public class ConfigServerApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
new SpringApplicationBuilder(ConfigServerApplication.class).properties(
|
||||
"spring.config.name=configserver", "debug=true").run(args);
|
||||
new SpringApplicationBuilder(ConfigServerApplication.class)
|
||||
.properties("spring.config.name=configserver").run(args);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,6 +25,9 @@ import org.springframework.cloud.config.server.resource.ResourceController;
|
||||
import org.springframework.cloud.config.server.resource.ResourceRepository;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
@@ -32,7 +35,8 @@ import org.springframework.context.annotation.Configuration;
|
||||
*/
|
||||
@Configuration
|
||||
@ConditionalOnWebApplication
|
||||
public class ConfigServerMvcConfiguration {
|
||||
public class ConfigServerMvcConfiguration extends WebMvcConfigurerAdapter {
|
||||
|
||||
@Autowired
|
||||
private EnvironmentRepository repository;
|
||||
|
||||
@@ -42,9 +46,16 @@ public class ConfigServerMvcConfiguration {
|
||||
@Autowired
|
||||
private ConfigServerProperties server;
|
||||
|
||||
@Autowired(required=false)
|
||||
@Autowired(required = false)
|
||||
private EnvironmentEncryptor environmentEncryptor;
|
||||
|
||||
@Override
|
||||
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
|
||||
configurer.mediaType("properties", MediaType.valueOf("text/plain"));
|
||||
configurer.mediaType("yml", MediaType.valueOf("text/yaml"));
|
||||
configurer.mediaType("yaml", MediaType.valueOf("text/yaml"));
|
||||
}
|
||||
|
||||
@Bean
|
||||
public EnvironmentController environmentController() {
|
||||
EnvironmentController controller = new EnvironmentController(encrypted());
|
||||
@@ -54,12 +65,14 @@ public class ConfigServerMvcConfiguration {
|
||||
|
||||
@Bean
|
||||
public ResourceController resourceController() {
|
||||
ResourceController controller = new ResourceController(this.resources, encrypted());
|
||||
ResourceController controller = new ResourceController(this.resources,
|
||||
encrypted());
|
||||
return controller;
|
||||
}
|
||||
|
||||
private EnvironmentEncryptorEnvironmentRepository encrypted() {
|
||||
EnvironmentEncryptorEnvironmentRepository encrypted = new EnvironmentEncryptorEnvironmentRepository(this.repository, this.environmentEncryptor);
|
||||
EnvironmentEncryptorEnvironmentRepository encrypted = new EnvironmentEncryptorEnvironmentRepository(
|
||||
this.repository, this.environmentEncryptor);
|
||||
encrypted.setOverrides(this.server.getOverrides());
|
||||
return encrypted;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user