Add boostrap and eureka-client samples
This commit is contained in:
15
bootstrap/src/main/java/demo/BootstrapClientApplication.java
Normal file
15
bootstrap/src/main/java/demo/BootstrapClientApplication.java
Normal file
@@ -0,0 +1,15 @@
|
||||
package demo;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*/
|
||||
@SpringBootApplication
|
||||
public class BootstrapClientApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(BootstrapClientApplication.class, args);
|
||||
}
|
||||
}
|
||||
5
bootstrap/src/main/resources/application.yml
Normal file
5
bootstrap/src/main/resources/application.yml
Normal file
@@ -0,0 +1,5 @@
|
||||
server:
|
||||
display-name: SAMPLE
|
||||
spring:
|
||||
application:
|
||||
name: client
|
||||
8
bootstrap/src/main/resources/bootstrap.yml
Normal file
8
bootstrap/src/main/resources/bootstrap.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
spring:
|
||||
config:
|
||||
# N.B. you don't normally want to do this in a real app. It switches
|
||||
# off the local application.yml:
|
||||
name: sample
|
||||
logging:
|
||||
level:
|
||||
org.springframework.boot: DEBUG
|
||||
4
bootstrap/src/main/resources/sample.yml
Normal file
4
bootstrap/src/main/resources/sample.yml
Normal file
@@ -0,0 +1,4 @@
|
||||
server:
|
||||
port: 8686
|
||||
tomcat:
|
||||
max-threads: 2
|
||||
@@ -0,0 +1,30 @@
|
||||
package demo;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.web.ServerProperties;
|
||||
import org.springframework.boot.test.SpringApplicationConfiguration;
|
||||
import org.springframework.boot.test.WebIntegrationTest;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@SpringApplicationConfiguration(classes = BootstrapClientApplication.class)
|
||||
@WebIntegrationTest("server.port=0")
|
||||
@DirtiesContext
|
||||
public class BootstrapClientApplicationTests {
|
||||
|
||||
@Autowired
|
||||
private ServerProperties server;
|
||||
|
||||
@Test
|
||||
public void contextLoads() throws Exception {
|
||||
assertEquals(2, this.server.getTomcat().getMaxThreads());
|
||||
// The application.yml is never read because spring.config.name=sample
|
||||
assertEquals("application", this.server.getDisplayName());
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user