Fast forward existing prototype work

This commit is contained in:
Dave Syer
2013-04-24 10:02:07 +01:00
parent 80b151e2b3
commit fb6b224470
294 changed files with 23494 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
package org.springframework.bootstrap.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;
@Configuration
@EnableAutoConfiguration
@ComponentScan
public class SimpleBootstrapApplication 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
// command line args ('--name=whatever') or application properties
@Autowired
private HelloWorldService helloWorldService;
@Override
public void run(String... args) {
System.out.println(this.helloWorldService.getHelloMessage());
}
public static void main(String[] args) throws Exception {
SpringApplication.run(SimpleBootstrapApplication.class, args);
}
}

View File

@@ -0,0 +1,16 @@
package org.springframework.bootstrap.sample.simple.service;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@Component
public class HelloWorldService {
@Value("${name:World}")
private String name;
public String getHelloMessage() {
return "Hello " + name;
}
}