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.profile;
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.MessageService;
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.profile.service.MessageService;
@Configuration
@EnableAutoConfiguration
@ComponentScan
public class ProfileBootstrapApplication implements CommandLineRunner {
public class SampleProfileApplication 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 ProfileBootstrapApplication implements CommandLineRunner {
}
public static void main(String[] args) throws Exception {
SpringApplication.run(ProfileBootstrapApplication.class, args);
SpringApplication.run(SampleProfileApplication.class, args);
}
}

View File

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

View File

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

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.bootstrap.sample.simple.service;
package org.springframework.zero.sample.profile.service;
/**
* @author Dave Syer

View File

@@ -1,4 +1,4 @@
package org.springframework.bootstrap.sample.simple;
package org.springframework.zero.sample.profile;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
@@ -8,10 +8,11 @@ import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.zero.sample.profile.SampleProfileApplication;
import static org.junit.Assert.assertTrue;
public class ProfileBootstrapApplicationTests {
public class SampleProfileApplicationTests {
private static PrintStream savedOutput;
private static ByteArrayOutputStream output;
@@ -49,7 +50,7 @@ public class ProfileBootstrapApplicationTests {
@Test
public void testDefaultProfile() throws Exception {
ProfileBootstrapApplication.main(new String[0]);
SampleProfileApplication.main(new String[0]);
String output = getOutput();
assertTrue("Wrong output: " + output, output.contains("Hello Phil"));
}
@@ -57,14 +58,14 @@ public class ProfileBootstrapApplicationTests {
@Test
public void testGoodbyeProfile() throws Exception {
System.setProperty("spring.profiles.active", "goodbye");
ProfileBootstrapApplication.main(new String[0]);
SampleProfileApplication.main(new String[0]);
String output = getOutput();
assertTrue("Wrong output: " + output, output.contains("Goodbye Everyone"));
}
@Test
public void testGoodbyeProfileFromCommandline() throws Exception {
ProfileBootstrapApplication
SampleProfileApplication
.main(new String[] { "--spring.profiles.active=goodbye" });
String output = getOutput();
assertTrue("Wrong output: " + output, output.contains("Goodbye Everyone"));