Commit d42bedf2 authored by Phillip Webb's avatar Phillip Webb

Rename @ConfigurationProperties attributes

Rename `name` to `prefix` and `path` to `locations`.
parent 07ad45c4
...@@ -26,7 +26,7 @@ import org.springframework.util.StringUtils; ...@@ -26,7 +26,7 @@ import org.springframework.util.StringUtils;
* *
* @author Christian Dupuis * @author Christian Dupuis
*/ */
@ConfigurationProperties(name = "endpoints.jmx") @ConfigurationProperties(prefix = "endpoints.jmx")
public class EndpointMBeanExportProperties { public class EndpointMBeanExportProperties {
private String domain; private String domain;
......
...@@ -27,7 +27,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties; ...@@ -27,7 +27,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
* @author Christian Dupuis * @author Christian Dupuis
* @author Dave Syer * @author Dave Syer
*/ */
@ConfigurationProperties(name = "jolokia") @ConfigurationProperties(prefix = "jolokia")
public class JolokiaProperties { public class JolokiaProperties {
private Map<String, String> config = new HashMap<String, String>(); private Map<String, String> config = new HashMap<String, String>();
......
...@@ -32,7 +32,7 @@ import org.springframework.util.ClassUtils; ...@@ -32,7 +32,7 @@ import org.springframework.util.ClassUtils;
* @author Dave Syer * @author Dave Syer
* @see ServerProperties * @see ServerProperties
*/ */
@ConfigurationProperties(name = "management", ignoreUnknownFields = false) @ConfigurationProperties(prefix = "management", ignoreUnknownFields = false)
public class ManagementServerProperties implements SecurityPrequisite { public class ManagementServerProperties implements SecurityPrequisite {
private static final String SECURITY_CHECK_CLASS = "org.springframework.security.config.http.SessionCreationPolicy"; private static final String SECURITY_CHECK_CLASS = "org.springframework.security.config.http.SessionCreationPolicy";
......
/* /*
* Copyright 2013 the original author or authors. * Copyright 2013-2014 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -36,7 +36,7 @@ import org.springframework.util.StringUtils; ...@@ -36,7 +36,7 @@ import org.springframework.util.StringUtils;
* @author Christian Dupuis * @author Christian Dupuis
* @author Phillip Webb * @author Phillip Webb
*/ */
@ConfigurationProperties(name = "shell", ignoreUnknownFields = true) @ConfigurationProperties(prefix = "shell", ignoreUnknownFields = true)
public class ShellProperties { public class ShellProperties {
private static Log logger = LogFactory.getLog(ShellProperties.class); private static Log logger = LogFactory.getLog(ShellProperties.class);
...@@ -279,7 +279,7 @@ public class ShellProperties { ...@@ -279,7 +279,7 @@ public class ShellProperties {
/** /**
* Auth specific properties for JAAS authentication * Auth specific properties for JAAS authentication
*/ */
@ConfigurationProperties(name = "shell.auth.jaas", ignoreUnknownFields = false) @ConfigurationProperties(prefix = "shell.auth.jaas", ignoreUnknownFields = false)
public static class JaasAuthenticationProperties extends public static class JaasAuthenticationProperties extends
CrshShellAuthenticationProperties { CrshShellAuthenticationProperties {
...@@ -305,7 +305,7 @@ public class ShellProperties { ...@@ -305,7 +305,7 @@ public class ShellProperties {
/** /**
* Auth specific properties for key authentication * Auth specific properties for key authentication
*/ */
@ConfigurationProperties(name = "shell.auth.key", ignoreUnknownFields = false) @ConfigurationProperties(prefix = "shell.auth.key", ignoreUnknownFields = false)
public static class KeyAuthenticationProperties extends public static class KeyAuthenticationProperties extends
CrshShellAuthenticationProperties { CrshShellAuthenticationProperties {
...@@ -333,7 +333,7 @@ public class ShellProperties { ...@@ -333,7 +333,7 @@ public class ShellProperties {
/** /**
* Auth specific properties for simple authentication * Auth specific properties for simple authentication
*/ */
@ConfigurationProperties(name = "shell.auth.simple", ignoreUnknownFields = false) @ConfigurationProperties(prefix = "shell.auth.simple", ignoreUnknownFields = false)
public static class SimpleAuthenticationProperties extends public static class SimpleAuthenticationProperties extends
CrshShellAuthenticationProperties { CrshShellAuthenticationProperties {
...@@ -402,7 +402,7 @@ public class ShellProperties { ...@@ -402,7 +402,7 @@ public class ShellProperties {
/** /**
* Auth specific properties for Spring authentication * Auth specific properties for Spring authentication
*/ */
@ConfigurationProperties(name = "shell.auth.spring", ignoreUnknownFields = false) @ConfigurationProperties(prefix = "shell.auth.spring", ignoreUnknownFields = false)
public static class SpringAuthenticationProperties extends public static class SpringAuthenticationProperties extends
CrshShellAuthenticationProperties { CrshShellAuthenticationProperties {
......
/* /*
* Copyright 2012-2013 the original author or authors. * Copyright 2012-2014 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -43,7 +43,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; ...@@ -43,7 +43,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
* @author Phillip Webb * @author Phillip Webb
* @author Dave Syer * @author Dave Syer
*/ */
@ConfigurationProperties(name = "endpoints.autoconfig", ignoreUnknownFields = false) @ConfigurationProperties(prefix = "endpoints.autoconfig", ignoreUnknownFields = false)
public class AutoConfigurationReportEndpoint extends AbstractEndpoint<Report> { public class AutoConfigurationReportEndpoint extends AbstractEndpoint<Report> {
@Autowired @Autowired
......
/* /*
* Copyright 2012-2013 the original author or authors. * Copyright 2012-2014 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -35,7 +35,7 @@ import org.springframework.core.env.Environment; ...@@ -35,7 +35,7 @@ import org.springframework.core.env.Environment;
* *
* @author Dave Syer * @author Dave Syer
*/ */
@ConfigurationProperties(name = "endpoints.beans", ignoreUnknownFields = false) @ConfigurationProperties(prefix = "endpoints.beans", ignoreUnknownFields = false)
public class BeansEndpoint extends AbstractEndpoint<List<Object>> implements public class BeansEndpoint extends AbstractEndpoint<List<Object>> implements
ApplicationContextAware { ApplicationContextAware {
......
...@@ -48,7 +48,7 @@ import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider; ...@@ -48,7 +48,7 @@ import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider;
* *
* @author Christian Dupuis * @author Christian Dupuis
*/ */
@ConfigurationProperties(name = "endpoints.configprops", ignoreUnknownFields = false) @ConfigurationProperties(prefix = "endpoints.configprops", ignoreUnknownFields = false)
public class ConfigurationPropertiesReportEndpoint extends public class ConfigurationPropertiesReportEndpoint extends
AbstractEndpoint<Map<String, Object>> implements ApplicationContextAware { AbstractEndpoint<Map<String, Object>> implements ApplicationContextAware {
...@@ -138,7 +138,7 @@ public class ConfigurationPropertiesReportEndpoint extends ...@@ -138,7 +138,7 @@ public class ConfigurationPropertiesReportEndpoint extends
ConfigurationProperties annotation = AnnotationUtils.findAnnotation( ConfigurationProperties annotation = AnnotationUtils.findAnnotation(
bean.getClass(), ConfigurationProperties.class); bean.getClass(), ConfigurationProperties.class);
return (StringUtils.hasLength(annotation.value()) ? annotation.value() return (StringUtils.hasLength(annotation.value()) ? annotation.value()
: annotation.name()); : annotation.prefix());
} }
/** /**
......
/* /*
* Copyright 2012-2013 the original author or authors. * Copyright 2012-2014 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -28,7 +28,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties; ...@@ -28,7 +28,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
* *
* @author Dave Syer * @author Dave Syer
*/ */
@ConfigurationProperties(name = "endpoints.dump", ignoreUnknownFields = false) @ConfigurationProperties(prefix = "endpoints.dump", ignoreUnknownFields = false)
public class DumpEndpoint extends AbstractEndpoint<List<ThreadInfo>> { public class DumpEndpoint extends AbstractEndpoint<List<ThreadInfo>> {
/** /**
......
/* /*
* Copyright 2012-2013 the original author or authors. * Copyright 2012-2014 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -33,7 +33,7 @@ import org.springframework.core.env.StandardEnvironment; ...@@ -33,7 +33,7 @@ import org.springframework.core.env.StandardEnvironment;
* @author Dave Syer * @author Dave Syer
* @author Phillip Webb * @author Phillip Webb
*/ */
@ConfigurationProperties(name = "endpoints.env", ignoreUnknownFields = false) @ConfigurationProperties(prefix = "endpoints.env", ignoreUnknownFields = false)
public class EnvironmentEndpoint extends AbstractEndpoint<Map<String, Object>> implements public class EnvironmentEndpoint extends AbstractEndpoint<Map<String, Object>> implements
EnvironmentAware { EnvironmentAware {
......
/* /*
* Copyright 2012-2013 the original author or authors. * Copyright 2012-2014 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -25,7 +25,7 @@ import org.springframework.util.Assert; ...@@ -25,7 +25,7 @@ import org.springframework.util.Assert;
* *
* @author Dave Syer * @author Dave Syer
*/ */
@ConfigurationProperties(name = "endpoints.health", ignoreUnknownFields = false) @ConfigurationProperties(prefix = "endpoints.health", ignoreUnknownFields = false)
public class HealthEndpoint<T> extends AbstractEndpoint<T> { public class HealthEndpoint<T> extends AbstractEndpoint<T> {
private final HealthIndicator<? extends T> indicator; private final HealthIndicator<? extends T> indicator;
......
/* /*
* Copyright 2012-2013 the original author or authors. * Copyright 2012-2014 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -28,7 +28,7 @@ import org.springframework.util.Assert; ...@@ -28,7 +28,7 @@ import org.springframework.util.Assert;
* *
* @author Dave Syer * @author Dave Syer
*/ */
@ConfigurationProperties(name = "endpoints.info", ignoreUnknownFields = false) @ConfigurationProperties(prefix = "endpoints.info", ignoreUnknownFields = false)
public class InfoEndpoint extends AbstractEndpoint<Map<String, Object>> { public class InfoEndpoint extends AbstractEndpoint<Map<String, Object>> {
private final Map<String, ? extends Object> info; private final Map<String, ? extends Object> info;
......
/* /*
* Copyright 2012-2013 the original author or authors. * Copyright 2012-2014 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -28,7 +28,7 @@ import org.springframework.util.Assert; ...@@ -28,7 +28,7 @@ import org.springframework.util.Assert;
* *
* @author Dave Syer * @author Dave Syer
*/ */
@ConfigurationProperties(name = "endpoints.metrics", ignoreUnknownFields = false) @ConfigurationProperties(prefix = "endpoints.metrics", ignoreUnknownFields = false)
public class MetricsEndpoint extends AbstractEndpoint<Map<String, Object>> { public class MetricsEndpoint extends AbstractEndpoint<Map<String, Object>> {
private final PublicMetrics metrics; private final PublicMetrics metrics;
......
/* /*
* Copyright 2012-2013 the original author or authors. * Copyright 2012-2014 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -31,7 +31,7 @@ import org.springframework.context.ConfigurableApplicationContext; ...@@ -31,7 +31,7 @@ import org.springframework.context.ConfigurableApplicationContext;
* @author Dave Syer * @author Dave Syer
* @author Christian Dupuis * @author Christian Dupuis
*/ */
@ConfigurationProperties(name = "endpoints.shutdown", ignoreUnknownFields = false) @ConfigurationProperties(prefix = "endpoints.shutdown", ignoreUnknownFields = false)
public class ShutdownEndpoint extends AbstractEndpoint<Map<String, Object>> implements public class ShutdownEndpoint extends AbstractEndpoint<Map<String, Object>> implements
ApplicationContextAware { ApplicationContextAware {
......
...@@ -28,7 +28,7 @@ import org.springframework.util.Assert; ...@@ -28,7 +28,7 @@ import org.springframework.util.Assert;
* *
* @author Dave Syer * @author Dave Syer
*/ */
@ConfigurationProperties(name = "endpoints.trace", ignoreUnknownFields = false) @ConfigurationProperties(prefix = "endpoints.trace", ignoreUnknownFields = false)
public class TraceEndpoint extends AbstractEndpoint<List<Trace>> { public class TraceEndpoint extends AbstractEndpoint<List<Trace>> {
private final TraceRepository repository; private final TraceRepository repository;
......
...@@ -42,7 +42,7 @@ import org.springframework.web.servlet.mvc.ServletWrappingController; ...@@ -42,7 +42,7 @@ import org.springframework.web.servlet.mvc.ServletWrappingController;
* *
* @author Christian Dupuis * @author Christian Dupuis
*/ */
@ConfigurationProperties(name = "endpoints.jolokia", ignoreUnknownFields = false) @ConfigurationProperties(prefix = "endpoints.jolokia", ignoreUnknownFields = false)
public class JolokiaMvcEndpoint implements MvcEndpoint, InitializingBean, public class JolokiaMvcEndpoint implements MvcEndpoint, InitializingBean,
ApplicationContextAware, ServletContextAware { ApplicationContextAware, ServletContextAware {
......
...@@ -34,7 +34,7 @@ import org.springframework.web.context.request.RequestContextHolder; ...@@ -34,7 +34,7 @@ import org.springframework.web.context.request.RequestContextHolder;
* *
* @author Dave Syer * @author Dave Syer
*/ */
@ConfigurationProperties(name = "error") @ConfigurationProperties(prefix = "error")
public class ManagementErrorEndpoint implements MvcEndpoint { public class ManagementErrorEndpoint implements MvcEndpoint {
private final ErrorController controller; private final ErrorController controller;
......
/* /*
* Copyright 2013 the original author or authors. * Copyright 2013-2014 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -86,7 +86,7 @@ public class ConfigurationPropertiesReportEndpointParentTests { ...@@ -86,7 +86,7 @@ public class ConfigurationPropertiesReportEndpointParentTests {
} }
@ConfigurationProperties(name = "test") @ConfigurationProperties(prefix = "test")
public static class TestProperties { public static class TestProperties {
private String myTestProperty = "654321"; private String myTestProperty = "654321";
......
/* /*
* Copyright 2013 the original author or authors. * Copyright 2013-2014 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -104,7 +104,7 @@ public class ConfigurationPropertiesReportEndpointTests extends ...@@ -104,7 +104,7 @@ public class ConfigurationPropertiesReportEndpointTests extends
} }
@ConfigurationProperties(name = "test") @ConfigurationProperties(prefix = "test")
public static class TestProperties { public static class TestProperties {
private String dbPassword = "123456"; private String dbPassword = "123456";
......
...@@ -25,7 +25,7 @@ import org.springframework.util.StringUtils; ...@@ -25,7 +25,7 @@ import org.springframework.util.StringUtils;
* @author Greg Turnquist * @author Greg Turnquist
* @author Dave Syer * @author Dave Syer
*/ */
@ConfigurationProperties(name = "spring.rabbitmq") @ConfigurationProperties(prefix = "spring.rabbitmq")
public class RabbitProperties { public class RabbitProperties {
private String host = "localhost"; private String host = "localhost";
......
...@@ -28,7 +28,7 @@ import org.springframework.util.StringUtils; ...@@ -28,7 +28,7 @@ import org.springframework.util.StringUtils;
* *
* @author Dave Syer * @author Dave Syer
*/ */
@ConfigurationProperties(name = DataSourceAutoConfiguration.CONFIGURATION_PREFIX) @ConfigurationProperties(prefix = DataSourceAutoConfiguration.CONFIGURATION_PREFIX)
@EnableConfigurationProperties @EnableConfigurationProperties
public abstract class AbstractDataSourceConfiguration implements BeanClassLoaderAware, public abstract class AbstractDataSourceConfiguration implements BeanClassLoaderAware,
InitializingBean { InitializingBean {
......
...@@ -23,7 +23,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties; ...@@ -23,7 +23,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
* *
* @author Greg Turnquist * @author Greg Turnquist
*/ */
@ConfigurationProperties(name = "spring.activemq") @ConfigurationProperties(prefix = "spring.activemq")
public class ActiveMQProperties { public class ActiveMQProperties {
private String brokerUrl = "tcp://localhost:61616"; private String brokerUrl = "tcp://localhost:61616";
......
...@@ -18,7 +18,7 @@ package org.springframework.boot.autoconfigure.jms; ...@@ -18,7 +18,7 @@ package org.springframework.boot.autoconfigure.jms;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
@ConfigurationProperties(name = "spring.jms") @ConfigurationProperties(prefix = "spring.jms")
public class JmsTemplateProperties { public class JmsTemplateProperties {
private boolean pubSubDomain = true; private boolean pubSubDomain = true;
......
...@@ -30,7 +30,7 @@ import com.mongodb.MongoClientURI; ...@@ -30,7 +30,7 @@ import com.mongodb.MongoClientURI;
* @author Dave Syer * @author Dave Syer
* @author Phillip Webb * @author Phillip Webb
*/ */
@ConfigurationProperties(name = "spring.data.mongodb") @ConfigurationProperties(prefix = "spring.data.mongodb")
public class MongoProperties { public class MongoProperties {
private String host; private String host;
......
...@@ -23,7 +23,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties; ...@@ -23,7 +23,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
* *
* @author Dave Syer * @author Dave Syer
*/ */
@ConfigurationProperties(name = "spring.redis") @ConfigurationProperties(prefix = "spring.redis")
public class RedisProperties { public class RedisProperties {
private String host = "localhost"; private String host = "localhost";
......
/* /*
* Copyright 2012-2013 the original author or authors. * Copyright 2012-2014 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -30,7 +30,7 @@ import org.springframework.util.StringUtils; ...@@ -30,7 +30,7 @@ import org.springframework.util.StringUtils;
* *
* @author Dave Syer * @author Dave Syer
*/ */
@ConfigurationProperties(name = "security", ignoreUnknownFields = false) @ConfigurationProperties(prefix = "security", ignoreUnknownFields = false)
public class SecurityProperties implements SecurityPrequisite { public class SecurityProperties implements SecurityPrequisite {
private boolean requireSsl; private boolean requireSsl;
......
...@@ -25,7 +25,7 @@ import org.springframework.http.converter.HttpMessageConverter; ...@@ -25,7 +25,7 @@ import org.springframework.http.converter.HttpMessageConverter;
* @author Dave Syer * @author Dave Syer
* @author Piotr Maj * @author Piotr Maj
*/ */
@ConfigurationProperties(name = "http.mappers", ignoreUnknownFields = false) @ConfigurationProperties(prefix = "http.mappers", ignoreUnknownFields = false)
public class HttpMapperProperties { public class HttpMapperProperties {
private boolean jsonPrettyPrint; private boolean jsonPrettyPrint;
......
...@@ -44,7 +44,7 @@ import org.springframework.util.StringUtils; ...@@ -44,7 +44,7 @@ import org.springframework.util.StringUtils;
* *
* @author Dave Syer * @author Dave Syer
*/ */
@ConfigurationProperties(name = "server", ignoreUnknownFields = false) @ConfigurationProperties(prefix = "server", ignoreUnknownFields = false)
public class ServerProperties implements EmbeddedServletContainerCustomizer { public class ServerProperties implements EmbeddedServletContainerCustomizer {
private Integer port; private Integer port;
......
/* /*
* Copyright 2012-2013 the original author or authors. * Copyright 2012-2014 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -19,7 +19,7 @@ package sample.actuator.log4j; ...@@ -19,7 +19,7 @@ package sample.actuator.log4j;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ConfigurationProperties(name = "service", ignoreUnknownFields = false) @ConfigurationProperties(prefix = "service", ignoreUnknownFields = false)
@Component @Component
public class ServiceProperties { public class ServiceProperties {
......
/* /*
* Copyright 2012-2013 the original author or authors. * Copyright 2012-2014 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -19,7 +19,7 @@ package sample.actuator; ...@@ -19,7 +19,7 @@ package sample.actuator;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ConfigurationProperties(name = "service", ignoreUnknownFields = false) @ConfigurationProperties(prefix = "service", ignoreUnknownFields = false)
@Component @Component
public class ServiceProperties { public class ServiceProperties {
......
/* /*
* Copyright 2012-2013 the original author or authors. * Copyright 2012-2014 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -19,7 +19,7 @@ package sample.actuator; ...@@ -19,7 +19,7 @@ package sample.actuator;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ConfigurationProperties(name = "service", ignoreUnknownFields = false) @ConfigurationProperties(prefix = "service", ignoreUnknownFields = false)
@Component @Component
public class ServiceProperties { public class ServiceProperties {
......
/* /*
* Copyright 2012-2013 the original author or authors. * Copyright 2012-2014 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -18,7 +18,7 @@ package sample.integration; ...@@ -18,7 +18,7 @@ package sample.integration;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
@ConfigurationProperties(name = "service", ignoreUnknownFields = false) @ConfigurationProperties(prefix = "service", ignoreUnknownFields = false)
public class ServiceProperties { public class ServiceProperties {
private String greeting = "Hello"; private String greeting = "Hello";
......
/* /*
* Copyright 2012-2013 the original author or authors. * Copyright 2012-2014 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -35,20 +35,18 @@ import java.lang.annotation.Target; ...@@ -35,20 +35,18 @@ import java.lang.annotation.Target;
public @interface ConfigurationProperties { public @interface ConfigurationProperties {
/** /**
* The (optional) name of the object to be bound. Properties to bind can have a name * The name prefix of the properties that are valid to bind to this object. Synonym
* prefix to select the properties that are valid to this object. Synonym for * for {@link #prefix()}.
* {@link #name()}.
* @return the name prefix of the properties to bind * @return the name prefix of the properties to bind
*/ */
String value() default ""; String value() default "";
/** /**
* The (optional) name of the object to be bound. Properties to bind can have a name * The name prefix of the properties that are valid to bind to this object. Synonym
* prefix to select the properties that are valid to this object. Synonym for * for {@link #value()}.
* {@link #value()}.
* @return the name prefix of the properties to bind * @return the name prefix of the properties to bind
*/ */
String name() default ""; String prefix() default "";
/** /**
* Flag to indicate that when binding to this object invalid fields should be ignored. * Flag to indicate that when binding to this object invalid fields should be ignored.
...@@ -80,10 +78,10 @@ public @interface ConfigurationProperties { ...@@ -80,10 +78,10 @@ public @interface ConfigurationProperties {
boolean exceptionIfInvalid() default true; boolean exceptionIfInvalid() default true;
/** /**
* Optionally provide an explicit resource path to bind to instead of using the * Optionally provide an explicit resource locations to bind to instead of using the
* default environment. * default environment.
* @return the path (or paths) of resources to bind to * @return the path (or paths) of resources to bind to
*/ */
String[] path() default {}; String[] locations() default {};
} }
...@@ -292,8 +292,8 @@ public class ConfigurationPropertiesBindingPostProcessor implements BeanPostProc ...@@ -292,8 +292,8 @@ public class ConfigurationPropertiesBindingPostProcessor implements BeanPostProc
.getTarget() : bean); .getTarget() : bean);
PropertiesConfigurationFactory<Object> factory = new PropertiesConfigurationFactory<Object>( PropertiesConfigurationFactory<Object> factory = new PropertiesConfigurationFactory<Object>(
target); target);
if (annotation != null && annotation.path().length != 0) { if (annotation != null && annotation.locations().length != 0) {
factory.setPropertySources(loadPropertySources(annotation.path())); factory.setPropertySources(loadPropertySources(annotation.locations()));
} }
else { else {
factory.setPropertySources(this.propertySources); factory.setPropertySources(this.propertySources);
...@@ -309,7 +309,7 @@ public class ConfigurationPropertiesBindingPostProcessor implements BeanPostProc ...@@ -309,7 +309,7 @@ public class ConfigurationPropertiesBindingPostProcessor implements BeanPostProc
factory.setExceptionIfInvalid(annotation.exceptionIfInvalid()); factory.setExceptionIfInvalid(annotation.exceptionIfInvalid());
factory.setIgnoreNestedProperties(annotation.ignoreNestedProperties()); factory.setIgnoreNestedProperties(annotation.ignoreNestedProperties());
String targetName = (StringUtils.hasLength(annotation.value()) ? annotation String targetName = (StringUtils.hasLength(annotation.value()) ? annotation
.value() : annotation.name()); .value() : annotation.prefix());
if (StringUtils.hasLength(targetName)) { if (StringUtils.hasLength(targetName)) {
factory.setTargetName(targetName); factory.setTargetName(targetName);
} }
......
...@@ -83,7 +83,7 @@ class EnableConfigurationPropertiesImportSelector implements ImportSelector { ...@@ -83,7 +83,7 @@ class EnableConfigurationPropertiesImportSelector implements ImportSelector {
ConfigurationProperties.class); ConfigurationProperties.class);
if (annotation != null) { if (annotation != null) {
return (StringUtils.hasLength(annotation.value()) ? annotation.value() return (StringUtils.hasLength(annotation.value()) ? annotation.value()
: annotation.name()); : annotation.prefix());
} }
return ""; return "";
} }
......
...@@ -128,7 +128,7 @@ public class ConfigurationPropertiesBindingPostProcessorTests { ...@@ -128,7 +128,7 @@ public class ConfigurationPropertiesBindingPostProcessorTests {
} }
@ConfigurationProperties(name = "test") @ConfigurationProperties(prefix = "test")
public static class PropertyWithValidatingSetter { public static class PropertyWithValidatingSetter {
private String foo; private String foo;
...@@ -157,7 +157,7 @@ public class ConfigurationPropertiesBindingPostProcessorTests { ...@@ -157,7 +157,7 @@ public class ConfigurationPropertiesBindingPostProcessorTests {
} }
@ConfigurationProperties(name = "test") @ConfigurationProperties(prefix = "test")
public static class PropertyWithoutJSR303 implements Validator { public static class PropertyWithoutJSR303 implements Validator {
private String foo; private String foo;
...@@ -215,7 +215,7 @@ public class ConfigurationPropertiesBindingPostProcessorTests { ...@@ -215,7 +215,7 @@ public class ConfigurationPropertiesBindingPostProcessorTests {
} }
@ConfigurationProperties(name = "test") @ConfigurationProperties(prefix = "test")
public static class PropertyWithJSR303 extends PropertyWithoutJSR303 { public static class PropertyWithJSR303 extends PropertyWithoutJSR303 {
@NotNull @NotNull
......
...@@ -464,7 +464,7 @@ public class EnableConfigurationPropertiesTests { ...@@ -464,7 +464,7 @@ public class EnableConfigurationPropertiesTests {
public static class SystemExampleConfig { public static class SystemExampleConfig {
} }
@ConfigurationProperties(name = "external") @ConfigurationProperties(prefix = "external")
public static class External { public static class External {
private String name; private String name;
...@@ -478,7 +478,7 @@ public class EnableConfigurationPropertiesTests { ...@@ -478,7 +478,7 @@ public class EnableConfigurationPropertiesTests {
} }
} }
@ConfigurationProperties(name = "another") @ConfigurationProperties(prefix = "another")
public static class Another { public static class Another {
private String name; private String name;
...@@ -492,7 +492,7 @@ public class EnableConfigurationPropertiesTests { ...@@ -492,7 +492,7 @@ public class EnableConfigurationPropertiesTests {
} }
} }
@ConfigurationProperties(name = "spring_test_external") @ConfigurationProperties(prefix = "spring_test_external")
public static class SystemEnvVar { public static class SystemEnvVar {
public String getVal() { public String getVal() {
...@@ -602,7 +602,7 @@ public class EnableConfigurationPropertiesTests { ...@@ -602,7 +602,7 @@ public class EnableConfigurationPropertiesTests {
protected static class StrictTestProperties extends TestProperties { protected static class StrictTestProperties extends TestProperties {
} }
@ConfigurationProperties(name = "spring.foo") @ConfigurationProperties(prefix = "spring.foo")
protected static class EmbeddedTestProperties extends TestProperties { protected static class EmbeddedTestProperties extends TestProperties {
} }
...@@ -653,7 +653,7 @@ public class EnableConfigurationPropertiesTests { ...@@ -653,7 +653,7 @@ public class EnableConfigurationPropertiesTests {
// No getter - you should be able to bind to a write-only bean // No getter - you should be able to bind to a write-only bean
} }
@ConfigurationProperties(path = "${binding.location:classpath:name.yml}") @ConfigurationProperties(locations = "${binding.location:classpath:name.yml}")
protected static class ResourceBindingProperties { protected static class ResourceBindingProperties {
private String name; private String name;
...@@ -666,7 +666,7 @@ public class EnableConfigurationPropertiesTests { ...@@ -666,7 +666,7 @@ public class EnableConfigurationPropertiesTests {
} }
@EnableConfigurationProperties @EnableConfigurationProperties
@ConfigurationProperties(path = "${binding.location:classpath:map.yml}") @ConfigurationProperties(locations = "${binding.location:classpath:map.yml}")
protected static class ResourceBindingPropertiesWithMap { protected static class ResourceBindingPropertiesWithMap {
private Map<String, String> mymap; private Map<String, String> mymap;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment