[bs-22] Move @ConfigurationProperties processing to main jar

Also add unit tests.  Note also the start.groovy for the service
sample now works.

[#48127729]
This commit is contained in:
Dave Syer
2013-05-01 14:01:13 +01:00
parent 89748028b4
commit bd79ec2362
11 changed files with 151 additions and 23 deletions

View File

@@ -2,7 +2,7 @@ package org.springframework.bootstrap.sample.consumer;
import org.springframework.bootstrap.SpringApplication;
import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration;
import org.springframework.bootstrap.service.annotation.EnableConfigurationProperties;
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;

View File

@@ -2,13 +2,13 @@ package org.springframework.bootstrap.sample.service;
import org.springframework.bootstrap.SpringApplication;
import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration;
import org.springframework.bootstrap.service.annotation.EnableConfigurationProperties;
import org.springframework.bootstrap.context.annotation.EnableConfigurationProperties;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
@Configuration
@EnableAutoConfiguration
@EnableConfigurationProperties(ServiceProperties.class)
@EnableConfigurationProperties
@ComponentScan
public class ServiceBootstrapApplication {

View File

@@ -16,14 +16,16 @@
package org.springframework.bootstrap.sample.service;
import org.springframework.bootstrap.context.annotation.ConfigurationProperties;
import org.springframework.stereotype.Component;
@ConfigurationProperties(name = "service", ignoreUnknownFields = false)
@Component
public class ServiceProperties {
private String name = "World";
public String getName() {
return name;
return this.name;
}
public void setName(String name) {

View File

@@ -1,4 +1,4 @@
@Configuration
@Import(org.springframework.bootstrap.sample.service.ServiceBootstrapApplication)
class Start {
}
@Grab("org.springframework.bootstrap:spring-bootstrap-service:0.0.1-SNAPSHOT")
@Grab("org.springframework.bootstrap:spring-bootstrap-web-application:0.0.1-SNAPSHOT")
class Start {
}