Restructure 'bootstrap' to use 'zero'

This commit is contained in:
Phillip Webb
2013-07-05 16:44:24 -07:00
parent d039822064
commit 261955c50b
443 changed files with 1361 additions and 1774 deletions

View File

@@ -14,20 +14,20 @@
* limitations under the License.
*/
package org.springframework.bootstrap.sample.simple;
package org.springframework.zero.sample.simple;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.bootstrap.CommandLineRunner;
import org.springframework.bootstrap.SpringApplication;
import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration;
import org.springframework.bootstrap.sample.simple.service.HelloWorldService;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.zero.CommandLineRunner;
import org.springframework.zero.SpringApplication;
import org.springframework.zero.context.annotation.EnableAutoConfiguration;
import org.springframework.zero.sample.simple.service.HelloWorldService;
@Configuration
@EnableAutoConfiguration
@ComponentScan
public class SimpleBootstrapApplication implements CommandLineRunner {
public class SampleSimpleApplication implements CommandLineRunner {
// Simple example shows how a command line spring application can execute an
// injected bean service. Also demonstrates how you can use @Value to inject
@@ -42,6 +42,6 @@ public class SimpleBootstrapApplication implements CommandLineRunner {
}
public static void main(String[] args) throws Exception {
SpringApplication.run(SimpleBootstrapApplication.class, args);
SpringApplication.run(SampleSimpleApplication.class, args);
}
}

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.bootstrap.sample.simple.service;
package org.springframework.zero.sample.simple.service;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

View File

@@ -1,4 +1,4 @@
package org.springframework.bootstrap.sample.simple;
package org.springframework.zero.sample.simple;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
@@ -9,10 +9,18 @@ import org.junit.Test;
import static org.junit.Assert.assertTrue;
public class SimpleBootstrapApplicationTests {
/**
* Tests for {@link SampleSimpleApplication}.
*
* @author Dave Syer
* @author Phillip Webb
*/
public class SampleSimpleApplicationTests {
private PrintStream savedOutput;
private ByteArrayOutputStream output;
private String profiles;
@Before
@@ -39,14 +47,14 @@ public class SimpleBootstrapApplicationTests {
@Test
public void testDefaultSettings() throws Exception {
SimpleBootstrapApplication.main(new String[0]);
SampleSimpleApplication.main(new String[0]);
String output = getOutput();
assertTrue("Wrong output: " + output, output.contains("Hello Phil"));
}
@Test
public void testCommandLineOverrides() throws Exception {
SimpleBootstrapApplication.main(new String[] { "--name=Gordon" });
SampleSimpleApplication.main(new String[] { "--name=Gordon" });
String output = getOutput();
assertTrue("Wrong output: " + output, output.contains("Hello Gordon"));
}