[bs-84] Add basic getting started guide to service project

Still work in progress, bubt enough there to get someone up a
nd running I hope
[#49047467]
This commit is contained in:
Dave Syer
2013-05-01 16:10:57 +01:00
parent bd79ec2362
commit ce0e443b0a
4 changed files with 252 additions and 1 deletions

View File

@@ -27,6 +27,9 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.BeanNameGenerator;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
import org.springframework.bootstrap.autoconfigure.batch.BatchAutoConfiguration;
import org.springframework.bootstrap.autoconfigure.data.JpaRepositoriesAutoConfiguration;
import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration;
import org.springframework.bootstrap.context.embedded.AnnotationConfigEmbeddedWebApplicationContext;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextInitializer;
@@ -608,4 +611,13 @@ public class SpringApplication {
}
public static void main(String[] args) {
run(new Class<?>[] { AutoMain.class }, args);
}
@EnableAutoConfiguration(exclude = { JpaRepositoriesAutoConfiguration.class,
BatchAutoConfiguration.class })
public static class AutoMain {
}
}

View File

@@ -26,6 +26,7 @@ import org.springframework.beans.BeansException;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.BeanNameGenerator;
import org.springframework.beans.factory.support.DefaultBeanNameGenerator;
import org.springframework.bootstrap.SpringApplication.AutoMain;
import org.springframework.bootstrap.context.embedded.AnnotationConfigEmbeddedWebApplicationContext;
import org.springframework.bootstrap.context.embedded.jetty.JettyEmbeddedServletContainerFactory;
import org.springframework.context.ApplicationContext;
@@ -152,6 +153,15 @@ public class SpringApplicationTests {
assertThat(getEnvironment().getProperty("foo"), equalTo("bar"));
}
@Test
public void emptytApplicationContext() throws Exception {
// This is the class that will be used for main()
SpringApplication application = new SpringApplication(AutoMain.class);
this.context = application.run();
assertThat(this.context,
instanceOf(AnnotationConfigEmbeddedWebApplicationContext.class));
}
@Test
public void defaultApplicationContext() throws Exception {
SpringApplication application = new SpringApplication(ExampleConfig.class);