[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:
@@ -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;
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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 {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user