mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-07-05 00:56:58 +08:00
Restructure packages
This commit is contained in:
parent
764a0a9af8
commit
2c05e9f150
@ -25,9 +25,9 @@ import org.springframework.zero.actuate.audit.InMemoryAuditEventRepository;
|
||||
import org.springframework.zero.actuate.audit.listener.AuditListener;
|
||||
import org.springframework.zero.actuate.security.AuthenticationAuditListener;
|
||||
import org.springframework.zero.actuate.security.AuthorizationAuditListener;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnClass;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnMissingBean;
|
||||
import org.springframework.zero.context.annotation.EnableAutoConfiguration;
|
||||
import org.springframework.zero.context.condition.ConditionalOnClass;
|
||||
import org.springframework.zero.context.condition.ConditionalOnMissingBean;
|
||||
|
||||
/**
|
||||
* {@link EnableAutoConfiguration Auto-configuration} for {@link AuditEvent}s.
|
||||
|
@ -45,8 +45,8 @@ import org.springframework.zero.actuate.metrics.MetricRepository;
|
||||
import org.springframework.zero.actuate.trace.InMemoryTraceRepository;
|
||||
import org.springframework.zero.actuate.trace.TraceRepository;
|
||||
import org.springframework.zero.bind.PropertiesConfigurationFactory;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnMissingBean;
|
||||
import org.springframework.zero.context.annotation.EnableAutoConfiguration;
|
||||
import org.springframework.zero.context.condition.ConditionalOnMissingBean;
|
||||
|
||||
/**
|
||||
* {@link EnableAutoConfiguration Auto-configuration} for common management
|
||||
|
@ -39,11 +39,11 @@ import org.springframework.zero.autoconfigure.PropertyPlaceholderAutoConfigurati
|
||||
import org.springframework.zero.autoconfigure.web.EmbeddedServletContainerAutoConfiguration;
|
||||
import org.springframework.zero.autoconfigure.web.WebMvcAutoConfiguration;
|
||||
import org.springframework.zero.context.annotation.AutoConfigureAfter;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnClass;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnMissingBean;
|
||||
import org.springframework.zero.context.annotation.EnableAutoConfiguration;
|
||||
import org.springframework.zero.context.condition.ConditionalOnClass;
|
||||
import org.springframework.zero.context.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.zero.context.embedded.AnnotationConfigEmbeddedWebApplicationContext;
|
||||
import org.springframework.zero.properties.ServerProperties;
|
||||
import org.springframework.zero.context.embedded.ServerProperties;
|
||||
|
||||
/**
|
||||
* {@link EnableAutoConfiguration Auto-configuration} to enable Spring MVC to handle
|
||||
|
@ -29,8 +29,8 @@ import org.springframework.web.servlet.HandlerMapping;
|
||||
import org.springframework.zero.actuate.endpoint.mvc.EndpointHandlerAdapter;
|
||||
import org.springframework.zero.actuate.endpoint.mvc.EndpointHandlerMapping;
|
||||
import org.springframework.zero.actuate.properties.ManagementServerProperties;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnBean;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnClass;
|
||||
import org.springframework.zero.context.condition.ConditionalOnBean;
|
||||
import org.springframework.zero.context.condition.ConditionalOnClass;
|
||||
import org.springframework.zero.context.embedded.ConfigurableEmbeddedServletContainerFactory;
|
||||
import org.springframework.zero.context.embedded.EmbeddedServletContainer;
|
||||
import org.springframework.zero.context.embedded.EmbeddedServletContainerCustomizer;
|
||||
|
@ -23,9 +23,9 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.web.servlet.DispatcherServlet;
|
||||
import org.springframework.zero.actuate.web.BasicErrorController;
|
||||
import org.springframework.zero.actuate.web.ErrorController;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnClass;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnMissingBean;
|
||||
import org.springframework.zero.context.annotation.EnableAutoConfiguration;
|
||||
import org.springframework.zero.context.condition.ConditionalOnClass;
|
||||
import org.springframework.zero.context.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.zero.context.embedded.ConfigurableEmbeddedServletContainerFactory;
|
||||
import org.springframework.zero.context.embedded.EmbeddedServletContainerCustomizer;
|
||||
import org.springframework.zero.context.embedded.ErrorPage;
|
||||
|
@ -20,9 +20,9 @@ import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.zero.actuate.properties.ManagementServerProperties;
|
||||
import org.springframework.zero.autoconfigure.web.ServerPropertiesAutoConfiguration;
|
||||
import org.springframework.zero.context.annotation.AutoConfigureAfter;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnMissingBean;
|
||||
import org.springframework.zero.context.annotation.EnableAutoConfiguration;
|
||||
import org.springframework.zero.context.annotation.EnableConfigurationProperties;
|
||||
import org.springframework.zero.context.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.zero.context.properties.EnableConfigurationProperties;
|
||||
|
||||
/**
|
||||
* {@link EnableAutoConfiguration Auto-configuration} for the
|
||||
|
@ -38,9 +38,9 @@ import org.springframework.web.util.UrlPathHelper;
|
||||
import org.springframework.zero.actuate.metrics.CounterService;
|
||||
import org.springframework.zero.actuate.metrics.GaugeService;
|
||||
import org.springframework.zero.context.annotation.AutoConfigureAfter;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnBean;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnClass;
|
||||
import org.springframework.zero.context.annotation.EnableAutoConfiguration;
|
||||
import org.springframework.zero.context.condition.ConditionalOnBean;
|
||||
import org.springframework.zero.context.condition.ConditionalOnClass;
|
||||
|
||||
/**
|
||||
* {@link EnableAutoConfiguration Auto-configuration} that records Servlet interactions
|
||||
|
@ -24,8 +24,8 @@ import org.springframework.zero.actuate.metrics.DefaultGaugeService;
|
||||
import org.springframework.zero.actuate.metrics.GaugeService;
|
||||
import org.springframework.zero.actuate.metrics.InMemoryMetricRepository;
|
||||
import org.springframework.zero.actuate.metrics.MetricRepository;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnMissingBean;
|
||||
import org.springframework.zero.context.annotation.EnableAutoConfiguration;
|
||||
import org.springframework.zero.context.condition.ConditionalOnMissingBean;
|
||||
|
||||
/**
|
||||
* {@link EnableAutoConfiguration Auto-configuration} for metrics services.
|
||||
|
@ -41,10 +41,10 @@ import org.springframework.zero.actuate.endpoint.Endpoint;
|
||||
import org.springframework.zero.actuate.endpoint.mvc.EndpointHandlerMapping;
|
||||
import org.springframework.zero.actuate.properties.SecurityProperties;
|
||||
import org.springframework.zero.actuate.web.ErrorController;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnClass;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnMissingBean;
|
||||
import org.springframework.zero.context.annotation.EnableAutoConfiguration;
|
||||
import org.springframework.zero.context.annotation.EnableConfigurationProperties;
|
||||
import org.springframework.zero.context.condition.ConditionalOnClass;
|
||||
import org.springframework.zero.context.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.zero.context.properties.EnableConfigurationProperties;
|
||||
|
||||
/**
|
||||
* {@link EnableAutoConfiguration Auto-configuration} for security of a web application or
|
||||
|
@ -20,8 +20,8 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.zero.actuate.trace.InMemoryTraceRepository;
|
||||
import org.springframework.zero.actuate.trace.TraceRepository;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnMissingBean;
|
||||
import org.springframework.zero.context.annotation.EnableAutoConfiguration;
|
||||
import org.springframework.zero.context.condition.ConditionalOnMissingBean;
|
||||
|
||||
/**
|
||||
* {@link EnableAutoConfiguration Auto-configuration} for {@link TraceRepository tracing}.
|
||||
|
@ -25,8 +25,8 @@ import org.springframework.web.servlet.DispatcherServlet;
|
||||
import org.springframework.zero.actuate.trace.TraceRepository;
|
||||
import org.springframework.zero.actuate.trace.WebRequestTraceFilter;
|
||||
import org.springframework.zero.context.annotation.AutoConfigureAfter;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnClass;
|
||||
import org.springframework.zero.context.annotation.EnableAutoConfiguration;
|
||||
import org.springframework.zero.context.condition.ConditionalOnClass;
|
||||
|
||||
/**
|
||||
* {@link EnableAutoConfiguration Auto-configuration} for {@link WebRequestTraceFilter
|
||||
|
@ -22,7 +22,7 @@ import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.context.support.LiveBeansView;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.zero.context.annotation.ConfigurationProperties;
|
||||
import org.springframework.zero.context.properties.ConfigurationProperties;
|
||||
|
||||
/**
|
||||
* Exposes JSON view of Spring beans. If the {@link Environment} contains a key setting
|
||||
|
@ -21,7 +21,7 @@ import java.lang.management.ThreadInfo;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.zero.context.annotation.ConfigurationProperties;
|
||||
import org.springframework.zero.context.properties.ConfigurationProperties;
|
||||
|
||||
/**
|
||||
* {@link Endpoint} to expose thread info.
|
||||
|
@ -25,7 +25,7 @@ import org.springframework.core.env.EnumerablePropertySource;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.core.env.PropertySource;
|
||||
import org.springframework.core.env.StandardEnvironment;
|
||||
import org.springframework.zero.context.annotation.ConfigurationProperties;
|
||||
import org.springframework.zero.context.properties.ConfigurationProperties;
|
||||
|
||||
/**
|
||||
* {@link Endpoint} to expose {@link ConfigurableEnvironment environment} information.
|
||||
|
@ -18,7 +18,7 @@ package org.springframework.zero.actuate.endpoint;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.zero.actuate.health.HealthIndicator;
|
||||
import org.springframework.zero.context.annotation.ConfigurationProperties;
|
||||
import org.springframework.zero.context.properties.ConfigurationProperties;
|
||||
|
||||
/**
|
||||
* {@link Endpoint} to expose application health.
|
||||
|
@ -21,7 +21,7 @@ import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.zero.context.annotation.ConfigurationProperties;
|
||||
import org.springframework.zero.context.properties.ConfigurationProperties;
|
||||
|
||||
/**
|
||||
* {@link Endpoint} to expose arbitrary application information.
|
||||
|
@ -21,7 +21,7 @@ import java.util.Map;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.zero.actuate.metrics.Metric;
|
||||
import org.springframework.zero.context.annotation.ConfigurationProperties;
|
||||
import org.springframework.zero.context.properties.ConfigurationProperties;
|
||||
|
||||
/**
|
||||
* {@link Endpoint} to expose {@link PublicMetrics}.
|
||||
|
@ -25,7 +25,7 @@ import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.zero.actuate.properties.ManagementServerProperties;
|
||||
import org.springframework.zero.context.annotation.ConfigurationProperties;
|
||||
import org.springframework.zero.context.properties.ConfigurationProperties;
|
||||
|
||||
/**
|
||||
* {@link ActionEndpoint} to shutdown the {@link ApplicationContext}.
|
||||
|
@ -21,7 +21,7 @@ import java.util.List;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.zero.actuate.trace.Trace;
|
||||
import org.springframework.zero.actuate.trace.TraceRepository;
|
||||
import org.springframework.zero.context.annotation.ConfigurationProperties;
|
||||
import org.springframework.zero.context.properties.ConfigurationProperties;
|
||||
|
||||
/**
|
||||
* {@link Endpoint} to expose {@link Trace} information.
|
||||
|
@ -38,8 +38,8 @@ import org.springframework.web.servlet.DispatcherServlet;
|
||||
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||
import org.springframework.zero.actuate.properties.ManagementServerProperties;
|
||||
import org.springframework.zero.actuate.web.BasicErrorController;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnBean;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnClass;
|
||||
import org.springframework.zero.context.condition.ConditionalOnBean;
|
||||
import org.springframework.zero.context.condition.ConditionalOnClass;
|
||||
import org.springframework.zero.context.embedded.ConfigurableEmbeddedServletContainerFactory;
|
||||
import org.springframework.zero.context.embedded.EmbeddedServletContainerCustomizer;
|
||||
import org.springframework.zero.context.embedded.EmbeddedServletContainerFactory;
|
||||
|
@ -20,8 +20,8 @@ import java.net.InetAddress;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import org.springframework.zero.context.annotation.ConfigurationProperties;
|
||||
import org.springframework.zero.properties.ServerProperties;
|
||||
import org.springframework.zero.context.embedded.ServerProperties;
|
||||
import org.springframework.zero.context.properties.ConfigurationProperties;
|
||||
|
||||
/**
|
||||
* Properties for the management server (e.g. port and path settings).
|
||||
|
@ -17,7 +17,7 @@
|
||||
package org.springframework.zero.actuate.properties;
|
||||
|
||||
import org.springframework.security.config.annotation.web.configurers.SessionCreationPolicy;
|
||||
import org.springframework.zero.context.annotation.ConfigurationProperties;
|
||||
import org.springframework.zero.context.properties.ConfigurationProperties;
|
||||
|
||||
/**
|
||||
* Properties for the security aspects of an application.
|
||||
|
@ -21,7 +21,7 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.zero.actuate.endpoint.BeansEndpoint;
|
||||
import org.springframework.zero.context.annotation.EnableConfigurationProperties;
|
||||
import org.springframework.zero.context.properties.EnableConfigurationProperties;
|
||||
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
@ -23,7 +23,7 @@ import org.junit.Test;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.zero.actuate.endpoint.DumpEndpoint;
|
||||
import org.springframework.zero.context.annotation.EnableConfigurationProperties;
|
||||
import org.springframework.zero.context.properties.EnableConfigurationProperties;
|
||||
|
||||
import static org.hamcrest.Matchers.greaterThan;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
@ -20,7 +20,7 @@ import org.junit.Test;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.zero.actuate.endpoint.EnvironmentEndpoint;
|
||||
import org.springframework.zero.context.annotation.EnableConfigurationProperties;
|
||||
import org.springframework.zero.context.properties.EnableConfigurationProperties;
|
||||
|
||||
import static org.hamcrest.Matchers.greaterThan;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
@ -21,7 +21,7 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.zero.actuate.endpoint.HealthEndpoint;
|
||||
import org.springframework.zero.actuate.health.HealthIndicator;
|
||||
import org.springframework.zero.context.annotation.EnableConfigurationProperties;
|
||||
import org.springframework.zero.context.properties.EnableConfigurationProperties;
|
||||
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
@ -22,7 +22,7 @@ import org.junit.Test;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.zero.actuate.endpoint.InfoEndpoint;
|
||||
import org.springframework.zero.context.annotation.EnableConfigurationProperties;
|
||||
import org.springframework.zero.context.properties.EnableConfigurationProperties;
|
||||
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
@ -25,7 +25,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.zero.actuate.endpoint.MetricsEndpoint;
|
||||
import org.springframework.zero.actuate.endpoint.PublicMetrics;
|
||||
import org.springframework.zero.actuate.metrics.Metric;
|
||||
import org.springframework.zero.context.annotation.EnableConfigurationProperties;
|
||||
import org.springframework.zero.context.properties.EnableConfigurationProperties;
|
||||
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
@ -21,7 +21,7 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.zero.actuate.endpoint.ShutdownEndpoint;
|
||||
import org.springframework.zero.actuate.properties.ManagementServerProperties;
|
||||
import org.springframework.zero.context.annotation.EnableConfigurationProperties;
|
||||
import org.springframework.zero.context.properties.EnableConfigurationProperties;
|
||||
|
||||
import static org.hamcrest.Matchers.startsWith;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
|
@ -25,7 +25,7 @@ import org.springframework.zero.actuate.endpoint.TraceEndpoint;
|
||||
import org.springframework.zero.actuate.trace.InMemoryTraceRepository;
|
||||
import org.springframework.zero.actuate.trace.Trace;
|
||||
import org.springframework.zero.actuate.trace.TraceRepository;
|
||||
import org.springframework.zero.context.annotation.EnableConfigurationProperties;
|
||||
import org.springframework.zero.context.properties.EnableConfigurationProperties;
|
||||
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
@ -23,8 +23,8 @@ import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.support.ResourceBundleMessageSource;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnMissingBean;
|
||||
import org.springframework.zero.context.annotation.EnableAutoConfiguration;
|
||||
import org.springframework.zero.context.condition.ConditionalOnMissingBean;
|
||||
|
||||
/**
|
||||
* {@link EnableAutoConfiguration Auto-configuration} for {@link MessageSource}.
|
||||
|
@ -22,8 +22,8 @@ import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnMissingBean;
|
||||
import org.springframework.zero.context.annotation.EnableAutoConfiguration;
|
||||
import org.springframework.zero.context.condition.ConditionalOnMissingBean;
|
||||
|
||||
/**
|
||||
* {@link EnableAutoConfiguration Auto-configuration} for
|
||||
|
@ -21,10 +21,10 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.zero.CommandLineRunner;
|
||||
import org.springframework.zero.ExitCodeGenerator;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnBean;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnClass;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnMissingBean;
|
||||
import org.springframework.zero.context.annotation.EnableAutoConfiguration;
|
||||
import org.springframework.zero.context.condition.ConditionalOnBean;
|
||||
import org.springframework.zero.context.condition.ConditionalOnClass;
|
||||
import org.springframework.zero.context.condition.ConditionalOnMissingBean;
|
||||
|
||||
/**
|
||||
* {@link EnableAutoConfiguration Auto-configuration} for Spring Batch.
|
||||
|
@ -21,9 +21,9 @@ import org.springframework.context.annotation.Import;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
||||
import org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnClass;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnMissingBean;
|
||||
import org.springframework.zero.context.annotation.EnableAutoConfiguration;
|
||||
import org.springframework.zero.context.condition.ConditionalOnClass;
|
||||
import org.springframework.zero.context.condition.ConditionalOnMissingBean;
|
||||
|
||||
/**
|
||||
* {@link EnableAutoConfiguration Auto-configuration} for Spring Data's JPA Repositories.
|
||||
|
@ -46,10 +46,10 @@ import org.springframework.jdbc.datasource.init.DatabasePopulatorUtils;
|
||||
import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.zero.context.annotation.ConditionLogUtils;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnClass;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnMissingBean;
|
||||
import org.springframework.zero.context.annotation.EnableAutoConfiguration;
|
||||
import org.springframework.zero.context.condition.ConditionLogUtils;
|
||||
import org.springframework.zero.context.condition.ConditionalOnClass;
|
||||
import org.springframework.zero.context.condition.ConditionalOnMissingBean;
|
||||
|
||||
/**
|
||||
* {@link EnableAutoConfiguration Auto-configuration} for {@link DataSource}.
|
||||
|
@ -25,10 +25,10 @@ import org.springframework.core.Ordered;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnBean;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnClass;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnMissingBean;
|
||||
import org.springframework.zero.context.annotation.EnableAutoConfiguration;
|
||||
import org.springframework.zero.context.condition.ConditionalOnBean;
|
||||
import org.springframework.zero.context.condition.ConditionalOnClass;
|
||||
import org.springframework.zero.context.condition.ConditionalOnMissingBean;
|
||||
|
||||
/**
|
||||
* {@link EnableAutoConfiguration Auto-configuration} for
|
||||
|
@ -30,8 +30,8 @@ import org.springframework.orm.jpa.vendor.Database;
|
||||
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnClass;
|
||||
import org.springframework.zero.context.annotation.EnableAutoConfiguration;
|
||||
import org.springframework.zero.context.condition.ConditionalOnClass;
|
||||
|
||||
/**
|
||||
* {@link EnableAutoConfiguration Auto-configuration} for Hibernate JPA.
|
||||
|
@ -36,9 +36,9 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.zero.autoconfigure.AutoConfigurationUtils;
|
||||
import org.springframework.zero.autoconfigure.jdbc.EmbeddedDatabaseConfiguration;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnBean;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnClass;
|
||||
import org.springframework.zero.context.annotation.EnableAutoConfiguration;
|
||||
import org.springframework.zero.context.condition.ConditionalOnBean;
|
||||
import org.springframework.zero.context.condition.ConditionalOnClass;
|
||||
|
||||
/**
|
||||
* Base {@link EnableAutoConfiguration Auto-configuration} for JPA.
|
||||
|
@ -33,10 +33,10 @@ import org.springframework.core.io.DefaultResourceLoader;
|
||||
import org.springframework.core.io.ResourceLoader;
|
||||
import org.springframework.zero.autoconfigure.web.WebMvcAutoConfiguration;
|
||||
import org.springframework.zero.context.annotation.AutoConfigureAfter;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnClass;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnMissingBean;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnMissingClass;
|
||||
import org.springframework.zero.context.annotation.EnableAutoConfiguration;
|
||||
import org.springframework.zero.context.condition.ConditionalOnClass;
|
||||
import org.springframework.zero.context.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.zero.context.condition.ConditionalOnMissingClass;
|
||||
import org.thymeleaf.TemplateProcessingParameters;
|
||||
import org.thymeleaf.resourceresolver.IResourceResolver;
|
||||
import org.thymeleaf.spring3.SpringTemplateEngine;
|
||||
|
@ -26,9 +26,9 @@ import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.web.servlet.DispatcherServlet;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnClass;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnMissingBean;
|
||||
import org.springframework.zero.context.annotation.EnableAutoConfiguration;
|
||||
import org.springframework.zero.context.condition.ConditionalOnClass;
|
||||
import org.springframework.zero.context.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.zero.context.embedded.EmbeddedServletContainerCustomizer;
|
||||
import org.springframework.zero.context.embedded.EmbeddedServletContainerCustomizerBeanPostProcessor;
|
||||
import org.springframework.zero.context.embedded.EmbeddedServletContainerFactory;
|
||||
|
@ -22,9 +22,9 @@ import javax.servlet.Servlet;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.multipart.support.StandardServletMultipartResolver;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnBean;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnClass;
|
||||
import org.springframework.zero.context.annotation.EnableAutoConfiguration;
|
||||
import org.springframework.zero.context.condition.ConditionalOnBean;
|
||||
import org.springframework.zero.context.condition.ConditionalOnClass;
|
||||
import org.springframework.zero.context.embedded.EmbeddedWebApplicationContext;
|
||||
|
||||
/**
|
||||
|
@ -16,22 +16,19 @@
|
||||
|
||||
package org.springframework.zero.autoconfigure.web;
|
||||
|
||||
import org.apache.catalina.valves.AccessLogValve;
|
||||
import org.apache.catalina.valves.RemoteIpValve;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnMissingBean;
|
||||
import org.springframework.zero.context.annotation.EnableAutoConfiguration;
|
||||
import org.springframework.zero.context.annotation.EnableConfigurationProperties;
|
||||
import org.springframework.zero.context.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.zero.context.embedded.ConfigurableEmbeddedServletContainerFactory;
|
||||
import org.springframework.zero.context.embedded.EmbeddedServletContainerCustomizer;
|
||||
import org.springframework.zero.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
|
||||
import org.springframework.zero.properties.ServerProperties;
|
||||
import org.springframework.zero.properties.ServerProperties.Tomcat;
|
||||
import org.springframework.zero.context.embedded.ServerProperties;
|
||||
import org.springframework.zero.context.properties.EnableConfigurationProperties;
|
||||
|
||||
/**
|
||||
* {@link EnableAutoConfiguration Auto-configuration} that configures the
|
||||
@ -42,8 +39,8 @@ import org.springframework.zero.properties.ServerProperties.Tomcat;
|
||||
*/
|
||||
@Configuration
|
||||
@EnableConfigurationProperties
|
||||
public class ServerPropertiesAutoConfiguration implements
|
||||
EmbeddedServletContainerCustomizer, ApplicationContextAware {
|
||||
public class ServerPropertiesAutoConfiguration implements ApplicationContextAware,
|
||||
EmbeddedServletContainerCustomizer {
|
||||
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@ -61,46 +58,12 @@ public class ServerPropertiesAutoConfiguration implements
|
||||
|
||||
@Override
|
||||
public void customize(ConfigurableEmbeddedServletContainerFactory factory) {
|
||||
|
||||
// Need to do a look up here to make it lazy
|
||||
ServerProperties server = this.applicationContext.getBean(ServerProperties.class);
|
||||
|
||||
factory.setPort(server.getPort());
|
||||
factory.setAddress(server.getAddress());
|
||||
factory.setContextPath(server.getContextPath());
|
||||
|
||||
if (factory instanceof TomcatEmbeddedServletContainerFactory) {
|
||||
configureTomcat((TomcatEmbeddedServletContainerFactory) factory, server);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void configureTomcat(TomcatEmbeddedServletContainerFactory tomcatFactory,
|
||||
ServerProperties configuration) {
|
||||
|
||||
Tomcat tomcat = configuration.getTomcat();
|
||||
if (tomcat.getBasedir() != null) {
|
||||
tomcatFactory.setBaseDirectory(tomcat.getBasedir());
|
||||
}
|
||||
|
||||
String remoteIpHeader = tomcat.getRemoteIpHeader();
|
||||
String protocolHeader = tomcat.getProtocolHeader();
|
||||
|
||||
if (StringUtils.hasText(remoteIpHeader) || StringUtils.hasText(protocolHeader)) {
|
||||
RemoteIpValve valve = new RemoteIpValve();
|
||||
valve.setRemoteIpHeader(remoteIpHeader);
|
||||
valve.setProtocolHeader(protocolHeader);
|
||||
tomcatFactory.addContextValves(valve);
|
||||
}
|
||||
|
||||
String pattern = tomcat.getAccessLogPattern();
|
||||
if (pattern != null) {
|
||||
AccessLogValve valve = new AccessLogValve();
|
||||
valve.setPattern(pattern);
|
||||
valve.setSuffix(".log");
|
||||
tomcatFactory.addContextValves(valve);
|
||||
}
|
||||
|
||||
String[] serverPropertiesBeans = this.applicationContext
|
||||
.getBeanNamesForType(ServerProperties.class);
|
||||
Assert.state(
|
||||
serverPropertiesBeans.length == 1,
|
||||
"Multiple ServerProperties beans registered "
|
||||
+ StringUtils.arrayToCommaDelimitedString(serverPropertiesBeans));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -49,10 +49,10 @@ import org.springframework.web.servlet.resource.ResourceHttpRequestHandler;
|
||||
import org.springframework.web.servlet.view.BeanNameViewResolver;
|
||||
import org.springframework.web.servlet.view.ContentNegotiatingViewResolver;
|
||||
import org.springframework.zero.context.annotation.AutoConfigureAfter;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnBean;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnClass;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnMissingBean;
|
||||
import org.springframework.zero.context.annotation.EnableAutoConfiguration;
|
||||
import org.springframework.zero.context.condition.ConditionalOnBean;
|
||||
import org.springframework.zero.context.condition.ConditionalOnClass;
|
||||
import org.springframework.zero.context.condition.ConditionalOnMissingBean;
|
||||
|
||||
/**
|
||||
* {@link EnableAutoConfiguration Auto-configuration} for {@link EnableWebMvc Web MVC}.
|
||||
|
@ -26,9 +26,9 @@ import org.springframework.context.annotation.Conditional;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.core.io.support.SpringFactoriesLoader;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnBean;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnClass;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnMissingBean;
|
||||
import org.springframework.zero.context.condition.ConditionalOnBean;
|
||||
import org.springframework.zero.context.condition.ConditionalOnClass;
|
||||
import org.springframework.zero.context.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.zero.context.embedded.EmbeddedServletContainerFactory;
|
||||
import org.springframework.zero.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
|
||||
|
||||
|
@ -25,7 +25,7 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.zero.autoconfigure.web.EmbeddedServletContainerAutoConfiguration;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnExpression;
|
||||
import org.springframework.zero.context.condition.ConditionalOnExpression;
|
||||
import org.springframework.zero.context.embedded.AnnotationConfigEmbeddedWebApplicationContext;
|
||||
import org.springframework.zero.context.embedded.ConfigurableEmbeddedServletContainerFactory;
|
||||
import org.springframework.zero.context.embedded.EmbeddedServletContainerCustomizer;
|
||||
|
@ -18,14 +18,13 @@ package org.springframework.zero.autoconfigure.web;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.hamcrest.Matchers;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.ExpectedException;
|
||||
import org.mockito.Mockito;
|
||||
import org.springframework.beans.factory.NoUniqueBeanDefinitionException;
|
||||
import org.springframework.beans.factory.BeanCreationException;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.zero.TestUtils;
|
||||
@ -34,8 +33,8 @@ import org.springframework.zero.context.embedded.AnnotationConfigEmbeddedWebAppl
|
||||
import org.springframework.zero.context.embedded.ConfigurableEmbeddedServletContainerFactory;
|
||||
import org.springframework.zero.context.embedded.EmbeddedServletContainerCustomizerBeanPostProcessor;
|
||||
import org.springframework.zero.context.embedded.EmbeddedServletContainerFactory;
|
||||
import org.springframework.zero.context.embedded.ServerProperties;
|
||||
import org.springframework.zero.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
|
||||
import org.springframework.zero.properties.ServerProperties;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
@ -100,8 +99,8 @@ public class ServerPropertiesAutoConfigurationTests {
|
||||
this.context.register(Config.class, MutiServerPropertiesBeanConfig.class,
|
||||
ServerPropertiesAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class);
|
||||
this.thrown.expectCause(Matchers
|
||||
.<Throwable> instanceOf(NoUniqueBeanDefinitionException.class));
|
||||
this.thrown.expect(BeanCreationException.class);
|
||||
this.thrown.expectMessage("Multiple ServerProperties");
|
||||
this.context.refresh();
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.zero.context.annotation;
|
||||
package org.springframework.zero.context.condition;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.zero.context.annotation;
|
||||
package org.springframework.zero.context.condition;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.springframework.core.type.AnnotatedTypeMetadata;
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.zero.context.annotation;
|
||||
package org.springframework.zero.context.condition;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.zero.context.annotation;
|
||||
package org.springframework.zero.context.condition;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.zero.context.annotation;
|
||||
package org.springframework.zero.context.condition;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.zero.context.annotation;
|
||||
package org.springframework.zero.context.condition;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.zero.context.annotation;
|
||||
package org.springframework.zero.context.condition;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.zero.context.annotation;
|
||||
package org.springframework.zero.context.condition;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.zero.context.annotation;
|
||||
package org.springframework.zero.context.condition;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.zero.context.annotation;
|
||||
package org.springframework.zero.context.condition;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.zero.context.annotation;
|
||||
package org.springframework.zero.context.condition;
|
||||
|
||||
import org.springframework.context.annotation.Condition;
|
||||
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.zero.context.annotation;
|
||||
package org.springframework.zero.context.condition;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.zero.context.annotation;
|
||||
package org.springframework.zero.context.condition;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.zero.context.annotation;
|
||||
package org.springframework.zero.context.condition;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.zero.context.annotation;
|
||||
package org.springframework.zero.context.condition;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.zero.context.annotation;
|
||||
package org.springframework.zero.context.condition;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.zero.context.annotation;
|
||||
package org.springframework.zero.context.condition;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.zero.context.annotation;
|
||||
package org.springframework.zero.context.condition;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
@ -14,22 +14,28 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.zero.properties;
|
||||
package org.springframework.zero.context.embedded;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.InetAddress;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import org.springframework.zero.context.annotation.ConfigurationProperties;
|
||||
import org.apache.catalina.valves.AccessLogValve;
|
||||
import org.apache.catalina.valves.RemoteIpValve;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.zero.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
|
||||
import org.springframework.zero.context.properties.ConfigurationProperties;
|
||||
|
||||
/**
|
||||
* Properties for the web server (e.g. port and path settings).
|
||||
* {@link ConfigurationProperties properties} for a web server (e.g. port and path
|
||||
* settings). Will be used to customize an {@link EmbeddedServletContainerFactory} when an
|
||||
* {@link EmbeddedServletContainerCustomizerBeanPostProcessor} is active.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*/
|
||||
@ConfigurationProperties(name = "server", ignoreUnknownFields = false)
|
||||
public class ServerProperties {
|
||||
public class ServerProperties implements EmbeddedServletContainerCustomizer {
|
||||
|
||||
private int port = 8080;
|
||||
|
||||
@ -68,8 +74,14 @@ public class ServerProperties {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public void setLoader(String value) {
|
||||
// no op
|
||||
@Override
|
||||
public void customize(ConfigurableEmbeddedServletContainerFactory factory) {
|
||||
factory.setPort(getPort());
|
||||
factory.setAddress(getAddress());
|
||||
factory.setContextPath(getContextPath());
|
||||
if (factory instanceof TomcatEmbeddedServletContainerFactory) {
|
||||
getTomcat().customizeTomcat((TomcatEmbeddedServletContainerFactory) factory);
|
||||
}
|
||||
}
|
||||
|
||||
public static class Tomcat {
|
||||
@ -114,6 +126,30 @@ public class ServerProperties {
|
||||
this.remoteIpHeader = remoteIpHeader;
|
||||
}
|
||||
|
||||
void customizeTomcat(TomcatEmbeddedServletContainerFactory factory) {
|
||||
if (getBasedir() != null) {
|
||||
factory.setBaseDirectory(getBasedir());
|
||||
}
|
||||
|
||||
String remoteIpHeader = getRemoteIpHeader();
|
||||
String protocolHeader = getProtocolHeader();
|
||||
if (StringUtils.hasText(remoteIpHeader)
|
||||
|| StringUtils.hasText(protocolHeader)) {
|
||||
RemoteIpValve valve = new RemoteIpValve();
|
||||
valve.setRemoteIpHeader(remoteIpHeader);
|
||||
valve.setProtocolHeader(protocolHeader);
|
||||
factory.addContextValves(valve);
|
||||
}
|
||||
|
||||
String accessLogPattern = getAccessLogPattern();
|
||||
if (accessLogPattern != null) {
|
||||
AccessLogValve valve = new AccessLogValve();
|
||||
valve.setPattern(accessLogPattern);
|
||||
valve.setSuffix(".log");
|
||||
factory.addContextValves(valve);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -338,6 +338,8 @@ public class TomcatEmbeddedServletContainerFactory extends
|
||||
this.contextLifecycleListeners.addAll(Arrays.asList(contextLifecycleListeners));
|
||||
}
|
||||
|
||||
// FIXME JavaDoc
|
||||
// FIXME Is this still needed?
|
||||
public TomcatEmbeddedServletContainerFactory getChildContextFactory(final String name) {
|
||||
|
||||
final Server server = this.tomcat.getServer();
|
||||
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.zero.context.annotation;
|
||||
package org.springframework.zero.context.properties;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
@ -26,7 +26,7 @@ import java.lang.annotation.Target;
|
||||
* Annotation for externalized configuration. Add this to a class definition if you want
|
||||
* to bind and validate some external Properties (e.g. from a .properties file).
|
||||
*
|
||||
* @see PropertySourcesBindingPostProcessor
|
||||
* @see ConfigurationPropertiesBindingPostProcessor
|
||||
*
|
||||
* @author Dave Syer
|
||||
*/
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.zero.context.annotation;
|
||||
package org.springframework.zero.context.properties;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
@ -30,6 +30,8 @@ import org.springframework.core.env.PropertySource;
|
||||
import org.springframework.core.env.PropertySources;
|
||||
import org.springframework.validation.Validator;
|
||||
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
|
||||
import org.springframework.zero.context.condition.ConditionalOnClass;
|
||||
import org.springframework.zero.context.condition.ConditionalOnMissingBean;
|
||||
|
||||
/**
|
||||
* Configuration for binding externalized application properties to
|
||||
@ -72,7 +74,7 @@ public class ConfigurationPropertiesBindingConfiguration {
|
||||
* @return a bean post processor to bind application properties
|
||||
*/
|
||||
@Bean
|
||||
public PropertySourcesBindingPostProcessor propertySourcesBinder() {
|
||||
public ConfigurationPropertiesBindingPostProcessor propertySourcesBinder() {
|
||||
PropertySources propertySources;
|
||||
|
||||
if (this.configurer != null) {
|
||||
@ -87,7 +89,7 @@ public class ConfigurationPropertiesBindingConfiguration {
|
||||
propertySources = new MutablePropertySources();
|
||||
}
|
||||
|
||||
PropertySourcesBindingPostProcessor processor = new PropertySourcesBindingPostProcessor();
|
||||
ConfigurationPropertiesBindingPostProcessor processor = new ConfigurationPropertiesBindingPostProcessor();
|
||||
processor.setValidator(this.validator);
|
||||
processor.setConversionService(this.conversionService);
|
||||
processor.setPropertySources(propertySources);
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.zero.context.annotation;
|
||||
package org.springframework.zero.context.properties;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.BeanCreationException;
|
||||
@ -29,7 +29,7 @@ import org.springframework.core.convert.support.DefaultConversionService;
|
||||
import org.springframework.core.env.PropertySources;
|
||||
import org.springframework.validation.Validator;
|
||||
import org.springframework.zero.bind.PropertiesConfigurationFactory;
|
||||
import org.springframework.zero.context.annotation.EnableConfigurationPropertiesImportSelector.ConfigurationPropertiesHolder;
|
||||
import org.springframework.zero.context.properties.EnableConfigurationPropertiesImportSelector.ConfigurationPropertiesHolder;
|
||||
|
||||
/**
|
||||
* {@link BeanPostProcessor} to bind {@link PropertySources} to beans annotated with
|
||||
@ -37,7 +37,7 @@ import org.springframework.zero.context.annotation.EnableConfigurationProperties
|
||||
*
|
||||
* @author Dave Syer
|
||||
*/
|
||||
public class PropertySourcesBindingPostProcessor implements BeanPostProcessor,
|
||||
public class ConfigurationPropertiesBindingPostProcessor implements BeanPostProcessor,
|
||||
BeanFactoryAware {
|
||||
|
||||
private PropertySources propertySources;
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.zero.context.annotation;
|
||||
package org.springframework.zero.context.properties;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.zero.context.annotation;
|
||||
package org.springframework.zero.context.properties;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -39,7 +39,7 @@ import org.springframework.util.MultiValueMap;
|
||||
*
|
||||
* @author Dave Syer
|
||||
*/
|
||||
public class EnableConfigurationPropertiesImportSelector implements ImportSelector {
|
||||
class EnableConfigurationPropertiesImportSelector implements ImportSelector {
|
||||
|
||||
@Override
|
||||
public String[] selectImports(AnnotationMetadata metadata) {
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.zero.context.annotation;
|
||||
package org.springframework.zero.context.condition;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
@ -25,7 +25,7 @@ import java.lang.annotation.Target;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.Conditional;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnMissingBean;
|
||||
import org.springframework.zero.context.condition.ConditionalOnMissingBean;
|
||||
|
||||
/**
|
||||
* {@link Conditional} that only matches when the specified bean classes and/or names are
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.zero.context.annotation;
|
||||
package org.springframework.zero.context.condition;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -22,7 +22,7 @@ import org.springframework.beans.factory.BeanCreationException;
|
||||
import org.springframework.context.annotation.Condition;
|
||||
import org.springframework.context.annotation.ConditionContext;
|
||||
import org.springframework.core.type.AnnotatedTypeMetadata;
|
||||
import org.springframework.zero.context.annotation.OnMissingBeanCondition;
|
||||
import org.springframework.zero.context.condition.OnMissingBeanCondition;
|
||||
|
||||
/**
|
||||
* {@link Condition} that checks that specific beans are missing.
|
@ -14,14 +14,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.zero.context.annotation;
|
||||
package org.springframework.zero.context.condition;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnNotWebApplication;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnWebApplication;
|
||||
import org.springframework.zero.context.condition.ConditionalOnNotWebApplication;
|
||||
import org.springframework.zero.context.condition.ConditionalOnWebApplication;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.zero.context.annotation;
|
||||
package org.springframework.zero.context.condition;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
@ -23,6 +23,7 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.context.annotation.ImportResource;
|
||||
import org.springframework.zero.context.condition.ConditionalOnBean;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.zero.context.annotation;
|
||||
package org.springframework.zero.context.condition;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
@ -93,13 +93,13 @@ public class OnClassConditionTests {
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@ImportResource("org/springframework/zero/context/annotation/foo.xml")
|
||||
@ImportResource("org/springframework/zero/context/foo.xml")
|
||||
protected static class XmlConfiguration {
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@Import(BasicConfiguration.class)
|
||||
@ImportResource("org/springframework/zero/context/annotation/foo.xml")
|
||||
@ImportResource("org/springframework/zero/context/foo.xml")
|
||||
protected static class CombinedXmlConfiguration {
|
||||
}
|
||||
}
|
@ -14,13 +14,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.zero.context.annotation;
|
||||
package org.springframework.zero.context.condition;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnExpression;
|
||||
import org.springframework.zero.context.condition.ConditionalOnExpression;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
@ -14,14 +14,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.zero.context.annotation;
|
||||
package org.springframework.zero.context.condition;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnMissingBean;
|
||||
import org.springframework.zero.context.annotation.OnMissingBeanCondition;
|
||||
import org.springframework.zero.context.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.zero.context.condition.OnMissingBeanCondition;
|
||||
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.junit.Assert.assertEquals;
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.zero.context.annotation;
|
||||
package org.springframework.zero.context.condition;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
@ -49,7 +49,7 @@ public class OnMissingClassConditionTests {
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@ConditionalOnMissingClass("org.springframework.zero.context.annotation.OnMissingClassConditionTests")
|
||||
@ConditionalOnMissingClass("org.springframework.zero.context.condition.OnMissingClassConditionTests")
|
||||
protected static class BasicConfiguration {
|
||||
@Bean
|
||||
public String bar() {
|
@ -14,13 +14,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.zero.context.annotation;
|
||||
package org.springframework.zero.context.condition;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnResource;
|
||||
import org.springframework.zero.context.condition.ConditionalOnResource;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
@ -14,15 +14,15 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.zero.context.annotation;
|
||||
package org.springframework.zero.context.condition;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.mock.web.MockServletContext;
|
||||
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnNotWebApplication;
|
||||
import org.springframework.zero.context.annotation.ConditionalOnWebApplication;
|
||||
import org.springframework.zero.context.condition.ConditionalOnNotWebApplication;
|
||||
import org.springframework.zero.context.condition.ConditionalOnWebApplication;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.zero.properties;
|
||||
package org.springframework.zero.context.embedded;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.util.Collections;
|
||||
@ -24,13 +24,12 @@ import java.util.Map;
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.MutablePropertyValues;
|
||||
import org.springframework.zero.bind.RelaxedDataBinder;
|
||||
import org.springframework.zero.properties.ServerProperties;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
|
||||
/**
|
||||
* Externalized configuration for server properties
|
||||
* Tests for {@link ServerProperties}.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*/
|
||||
@ -69,4 +68,6 @@ public class ServerPropertiesTests {
|
||||
.getProtocolHeader());
|
||||
}
|
||||
|
||||
// FIXME test customize
|
||||
|
||||
}
|
@ -13,7 +13,8 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.zero.context.annotation;
|
||||
|
||||
package org.springframework.zero.context.properties;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@ -28,11 +29,15 @@ import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.ImportResource;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.zero.TestUtils;
|
||||
import org.springframework.zero.context.condition.AssertMissingBean;
|
||||
import org.springframework.zero.context.condition.ConditionalOnMissingBean;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
/**
|
||||
* Tests for {@link EnableConfigurationProperties}.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*/
|
||||
public class EnableConfigurationPropertiesTests {
|
||||
@ -168,7 +173,7 @@ public class EnableConfigurationPropertiesTests {
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@ImportResource("org/springframework/zero/context/annotation/testProperties.xml")
|
||||
@ImportResource("org/springframework/zero/context/properties/testProperties.xml")
|
||||
protected static class DefaultXmlConfiguration {
|
||||
}
|
||||
|
@ -27,8 +27,8 @@ import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.env.PropertiesPropertySource;
|
||||
import org.springframework.core.io.ByteArrayResource;
|
||||
import org.springframework.core.io.support.PropertiesLoaderUtils;
|
||||
import org.springframework.zero.context.annotation.ConfigurationProperties;
|
||||
import org.springframework.zero.context.annotation.EnableConfigurationProperties;
|
||||
import org.springframework.zero.context.properties.ConfigurationProperties;
|
||||
import org.springframework.zero.context.properties.EnableConfigurationProperties;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
|
@ -4,8 +4,8 @@
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
|
||||
<bean
|
||||
id="org.springframework.zero.context.annotation.EnableConfigurationPropertiesTests$TestProperties"
|
||||
class="org.springframework.zero.context.annotation.EnableConfigurationPropertiesTests$TestProperties">
|
||||
id="org.springframework.zero.context.properties.EnableConfigurationPropertiesTests$TestProperties"
|
||||
class="org.springframework.zero.context.properties.EnableConfigurationPropertiesTests$TestProperties">
|
||||
<property name="name" value="bar"/>
|
||||
</bean>
|
||||
|
@ -20,7 +20,7 @@ import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.zero.SpringApplication;
|
||||
import org.springframework.zero.context.annotation.EnableAutoConfiguration;
|
||||
import org.springframework.zero.context.annotation.EnableConfigurationProperties;
|
||||
import org.springframework.zero.context.properties.EnableConfigurationProperties;
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
|
@ -17,7 +17,7 @@
|
||||
package org.springframework.zero.sample.actuator;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.zero.context.annotation.ConfigurationProperties;
|
||||
import org.springframework.zero.context.properties.ConfigurationProperties;
|
||||
|
||||
@ConfigurationProperties(name = "service", ignoreUnknownFields = false)
|
||||
@Component
|
||||
|
@ -21,7 +21,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.ImportResource;
|
||||
import org.springframework.zero.SpringApplication;
|
||||
import org.springframework.zero.context.annotation.EnableAutoConfiguration;
|
||||
import org.springframework.zero.context.annotation.EnableConfigurationProperties;
|
||||
import org.springframework.zero.context.properties.EnableConfigurationProperties;
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.zero.sample.integration;
|
||||
|
||||
import org.springframework.zero.context.annotation.ConfigurationProperties;
|
||||
import org.springframework.zero.context.properties.ConfigurationProperties;
|
||||
|
||||
@ConfigurationProperties(name = "service", ignoreUnknownFields = false)
|
||||
public class ServiceProperties {
|
||||
|
Loading…
Reference in New Issue
Block a user