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,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.bootstrap.sample.consumer;
package org.springframework.zero.sample.integration;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.bootstrap.sample.consumer;
package org.springframework.zero.sample.integration;
import java.io.File;
import java.io.FileInputStream;

View File

@@ -14,24 +14,24 @@
* limitations under the License.
*/
package org.springframework.bootstrap.sample.consumer;
package org.springframework.zero.sample.integration;
import org.springframework.bootstrap.SpringApplication;
import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration;
import org.springframework.bootstrap.context.annotation.EnableConfigurationProperties;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
import org.springframework.zero.SpringApplication;
import org.springframework.zero.context.annotation.EnableAutoConfiguration;
import org.springframework.zero.context.annotation.EnableConfigurationProperties;
@Configuration
@EnableAutoConfiguration
@EnableConfigurationProperties(ServiceProperties.class)
@ComponentScan
@ImportResource("integration-context.xml")
public class IntegrationBootstrapApplication {
public class SampleIntegrationApplication {
public static void main(String[] args) throws Exception {
SpringApplication.run(IntegrationBootstrapApplication.class, args);
SpringApplication.run(SampleIntegrationApplication.class, args);
}
}

View File

@@ -14,9 +14,9 @@
* limitations under the License.
*/
package org.springframework.bootstrap.sample.consumer;
package org.springframework.zero.sample.integration;
import org.springframework.bootstrap.context.annotation.ConfigurationProperties;
import org.springframework.zero.context.annotation.ConfigurationProperties;
@ConfigurationProperties(name = "service", ignoreUnknownFields = false)
public class ServiceProperties {

View File

@@ -1,4 +1,4 @@
package org.springframework.bootstrap.sample.consumer;
package org.springframework.zero.sample.integration.consumer;
import java.util.concurrent.Callable;
import java.util.concurrent.Executors;
@@ -8,13 +8,14 @@ import java.util.concurrent.TimeUnit;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.bootstrap.SpringApplication;
import org.springframework.bootstrap.sample.producer.ProducerApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.io.DefaultResourceLoader;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.ResourcePatternUtils;
import org.springframework.util.StreamUtils;
import org.springframework.zero.SpringApplication;
import org.springframework.zero.sample.integration.SampleIntegrationApplication;
import org.springframework.zero.sample.integration.producer.ProducerApplication;
import static org.junit.Assert.assertTrue;
@@ -23,14 +24,14 @@ import static org.junit.Assert.assertTrue;
*
* @author Dave Syer
*/
public class IntegrationBootstrapApplicationTests {
public class SampleIntegrationApplicationTests {
private static ConfigurableApplicationContext context;
@BeforeClass
public static void start() throws Exception {
context = (ConfigurableApplicationContext) SpringApplication
.run(IntegrationBootstrapApplication.class);
.run(SampleIntegrationApplication.class);
}
@AfterClass

View File

@@ -1,11 +1,11 @@
package org.springframework.bootstrap.sample.producer;
package org.springframework.zero.sample.integration.producer;
import java.io.File;
import java.io.FileOutputStream;
import org.springframework.bootstrap.CommandLineRunner;
import org.springframework.bootstrap.SpringApplication;
import org.springframework.context.annotation.Configuration;
import org.springframework.zero.CommandLineRunner;
import org.springframework.zero.SpringApplication;
@Configuration
public class ProducerApplication implements CommandLineRunner {
@@ -13,13 +13,15 @@ public class ProducerApplication implements CommandLineRunner {
@Override
public void run(String... args) throws Exception {
new File("target/input").mkdirs();
FileOutputStream stream = new FileOutputStream("target/input/data"
+ System.currentTimeMillis() + ".txt");
for (String arg : args) {
stream.write(arg.getBytes());
if (args.length > 0) {
FileOutputStream stream = new FileOutputStream("target/input/data"
+ System.currentTimeMillis() + ".txt");
for (String arg : args) {
stream.write(arg.getBytes());
}
stream.flush();
stream.close();
}
stream.flush();
stream.close();
}
public static void main(String[] args) throws Exception {