mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Polish
This commit is contained in:
parent
7bea9dd973
commit
cf655945aa
@ -28,7 +28,6 @@ public interface AuditEventRepository {
|
||||
|
||||
/**
|
||||
* Find audit events relating to the specified principal since the time provided.
|
||||
*
|
||||
* @param principal the principal name to search for
|
||||
* @param after timestamp of earliest result required
|
||||
* @return audit events relating to the principal
|
||||
@ -37,7 +36,6 @@ public interface AuditEventRepository {
|
||||
|
||||
/**
|
||||
* Log an event.
|
||||
*
|
||||
* @param event the audit event to log
|
||||
*/
|
||||
void add(AuditEvent event);
|
||||
|
@ -55,7 +55,6 @@ public class EndpointWebMvcChildContextConfiguration implements
|
||||
factory.setPort(this.managementServerProperties.getPort());
|
||||
factory.setAddress(this.managementServerProperties.getAddress());
|
||||
factory.setContextPath(this.managementServerProperties.getContextPath());
|
||||
// TODO: Disable sessions
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ -86,10 +85,6 @@ public class EndpointWebMvcChildContextConfiguration implements
|
||||
@ConditionalOnBean(name = "springSecurityFilterChain", search = SearchStrategy.PARENTS)
|
||||
public static class EndpointWebMvcChildContextSecurityConfiguration {
|
||||
|
||||
// FIXME reuse of security filter here is not good. What if totally different
|
||||
// security config is required. Perhaps we can just drop it on the management
|
||||
// port?
|
||||
|
||||
@Bean
|
||||
public Filter springSecurityFilterChain(HierarchicalBeanFactory beanFactory) {
|
||||
BeanFactory parent = beanFactory.getParentBeanFactory();
|
||||
|
@ -152,7 +152,6 @@ public class SecurityAutoConfiguration {
|
||||
list.add(path);
|
||||
}
|
||||
}
|
||||
// FIXME makes more sense to secure endpoints with a different role
|
||||
list.addAll(Arrays.asList(getEndpointPaths(true)));
|
||||
return list.toArray(new String[list.size()]);
|
||||
}
|
||||
@ -178,9 +177,6 @@ public class SecurityAutoConfiguration {
|
||||
return NO_PATHS;
|
||||
}
|
||||
|
||||
// FIXME this will still open up paths on the server when a management port is
|
||||
// being used.
|
||||
|
||||
List<Endpoint<?>> endpoints = this.endpointHandlerMapping.getEndpoints();
|
||||
List<String> paths = new ArrayList<String>(endpoints.size());
|
||||
for (Endpoint<?> endpoint : endpoints) {
|
||||
|
@ -28,6 +28,7 @@ public class DefaultGaugeService implements GaugeService {
|
||||
private MetricRepository metricRepository;
|
||||
|
||||
/**
|
||||
* Create a new {@link DefaultGaugeService} instance.
|
||||
* @param counterRepository
|
||||
*/
|
||||
public DefaultGaugeService(MetricRepository counterRepository) {
|
||||
|
@ -23,6 +23,8 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
/**
|
||||
* {@link MetricRepository} implementation that stores metric in-memory.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*/
|
||||
public class InMemoryMetricRepository implements MetricRepository {
|
||||
@ -31,7 +33,6 @@ public class InMemoryMetricRepository implements MetricRepository {
|
||||
|
||||
@Override
|
||||
public void increment(String metricName, int amount, Date timestamp) {
|
||||
// FIXME this might not be thread safe
|
||||
Measurement current = this.metrics.get(metricName);
|
||||
if (current != null) {
|
||||
Metric metric = current.getMetric();
|
||||
|
@ -26,12 +26,6 @@ import java.util.Date;
|
||||
*/
|
||||
public interface MetricRepository {
|
||||
|
||||
// FIXME perhaps revisit this, there is no way to get timestamps
|
||||
// could also simply, leaving increment to counter service
|
||||
|
||||
// Perhaps findAll, findOne should return Measurements
|
||||
// put(String name, Callback -> process(Metric)
|
||||
|
||||
void increment(String metricName, int amount, Date timestamp);
|
||||
|
||||
void set(String metricName, double value, Date timestamp);
|
||||
|
@ -26,6 +26,9 @@ import org.springframework.stereotype.Controller;
|
||||
*/
|
||||
public interface ErrorController {
|
||||
|
||||
/**
|
||||
* Returns the path of the error page.
|
||||
*/
|
||||
public String getErrorPath();
|
||||
|
||||
}
|
||||
|
@ -1,39 +0,0 @@
|
||||
/*
|
||||
* Copyright 2012-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.actuate.fixme;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*/
|
||||
public class ErrorConfigurationTests {
|
||||
|
||||
// private AnnotationConfigApplicationContext context;
|
||||
//
|
||||
// @Test
|
||||
// public void testErrorEndpointConfiguration() throws Exception {
|
||||
// this.context = new AnnotationConfigApplicationContext();
|
||||
// this.context.register(ErrorConfiguration.class,
|
||||
// ActuatorServerPropertiesConfiguration.class,
|
||||
// PropertyPlaceholderAutoConfiguration.class);
|
||||
// this.context.refresh();
|
||||
// assertNotNull(this.context.getBean(ErrorEndpoint.class));
|
||||
// ConfigurableEmbeddedServletContainerFactory factory = Mockito
|
||||
// .mock(ConfigurableEmbeddedServletContainerFactory.class);
|
||||
// this.context.getBean(EmbeddedServletContainerCustomizer.class).customize(factory);
|
||||
// Mockito.verify(factory).addErrorPages(Mockito.any(ErrorPage.class));
|
||||
// }
|
||||
}
|
@ -30,5 +30,10 @@ import java.lang.annotation.Target;
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ ElementType.TYPE })
|
||||
public @interface AutoConfigureAfter {
|
||||
|
||||
/**
|
||||
* The auto-configure classes that should have already been applied.
|
||||
*/
|
||||
Class<?>[] value();
|
||||
|
||||
}
|
||||
|
@ -30,5 +30,10 @@ import java.lang.annotation.Target;
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ ElementType.TYPE })
|
||||
public @interface AutoConfigureBefore {
|
||||
|
||||
/**
|
||||
* The auto-configure classes that should have not yet been applied.
|
||||
*/
|
||||
Class<?>[] value();
|
||||
|
||||
}
|
||||
|
@ -36,7 +36,6 @@ import org.springframework.context.annotation.Configuration;
|
||||
public class BatchAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
// Harmless to always include this, but maybe could make it conditional as well
|
||||
public BatchDatabaseInitializer batchDatabaseInitializer() {
|
||||
return new BatchDatabaseInitializer();
|
||||
}
|
||||
|
@ -27,10 +27,12 @@ public enum SearchStrategy {
|
||||
* Search only the current context
|
||||
*/
|
||||
CURRENT,
|
||||
|
||||
/**
|
||||
* Search all parents and ancestors, but not the current context
|
||||
*/
|
||||
PARENTS,
|
||||
|
||||
/**
|
||||
* Search the entire hierarchy
|
||||
*
|
||||
|
@ -28,8 +28,6 @@ import org.springframework.util.StringUtils;
|
||||
*/
|
||||
public class AbstractDataSourceConfiguration {
|
||||
|
||||
// TODO: add pool parameters
|
||||
|
||||
@Value("${spring.database.driverClassName:}")
|
||||
private String driverClassName;
|
||||
|
||||
|
@ -86,7 +86,6 @@ public class DataSourceAutoConfiguration {
|
||||
|
||||
@Configuration
|
||||
@Conditional(DataSourceAutoConfiguration.SomeDatabaseCondition.class)
|
||||
// FIXME: make this @ConditionalOnBean(DataSource.class)
|
||||
protected static class JdbcTemplateConfiguration {
|
||||
|
||||
@Autowired(required = false)
|
||||
|
@ -78,7 +78,6 @@ public class HibernateJpaAutoConfiguration extends JpaBaseConfiguration {
|
||||
protected void configure(
|
||||
LocalContainerEntityManagerFactoryBean entityManagerFactoryBean) {
|
||||
Map<String, Object> properties = entityManagerFactoryBean.getJpaPropertyMap();
|
||||
// FIXME: detect EhCache
|
||||
properties.put("hibernate.cache.provider_class",
|
||||
"org.hibernate.cache.HashtableCacheProvider");
|
||||
if (StringUtils.hasLength(this.ddlAuto) && !"none".equals(this.ddlAuto)) {
|
||||
|
@ -17,6 +17,7 @@
|
||||
package org.springframework.boot.autoconfigure.reactor;
|
||||
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration;
|
||||
@ -30,6 +31,8 @@ import reactor.core.Reactor;
|
||||
import reactor.spring.context.ConsumerBeanPostProcessor;
|
||||
|
||||
/**
|
||||
* {@link EnableAutoConfiguration Auto-configuration} for Reactor.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*/
|
||||
@Configuration
|
||||
@ -40,7 +43,7 @@ public class ReactorAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
public Environment reactorEnvironment() {
|
||||
return new Environment(); // TODO: use Spring Environment to configure?
|
||||
return new Environment();
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
@ -46,7 +46,7 @@ import org.thymeleaf.templateresolver.ITemplateResolver;
|
||||
import org.thymeleaf.templateresolver.TemplateResolver;
|
||||
|
||||
/**
|
||||
* {@link EnableAutoConfiguration Auto-configuration} for Thymeleaf templating.
|
||||
* {@link EnableAutoConfiguration Auto-configuration} for Thymeleaf.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*/
|
||||
|
@ -1,57 +0,0 @@
|
||||
/*
|
||||
* Copyright 2012-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.cli.command;
|
||||
|
||||
import joptsimple.OptionSet;
|
||||
|
||||
import org.springframework.boot.cli.Command;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
|
||||
/**
|
||||
* {@link Command} to 'create' a new spring groovy script.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
*/
|
||||
public class CreateCommand extends OptionParsingCommand {
|
||||
|
||||
public CreateCommand() {
|
||||
super("create", "Create an new spring groovy script", new CreateOptionHandler());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUsageHelp() {
|
||||
return "[options] <file>";
|
||||
}
|
||||
|
||||
private static class CreateOptionHandler extends OptionHandler {
|
||||
|
||||
@Override
|
||||
protected void options() {
|
||||
option(asList("overwite", "f"), "Overwrite any existing file");
|
||||
option("type", "Create a specific application type").withOptionalArg()
|
||||
.ofType(String.class).describedAs("web, batch, integration");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void run(OptionSet options) {
|
||||
throw new IllegalStateException("Not implemented"); // FIXME
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -121,8 +121,6 @@ public class RunCommand extends OptionParsingCommand {
|
||||
if ("--".equals(filename)) {
|
||||
break;
|
||||
}
|
||||
// TODO: add support for strict Java compilation
|
||||
// TODO: add support for recursive search in directory
|
||||
if (filename.endsWith(".groovy") || filename.endsWith(".java")) {
|
||||
File file = new File(filename);
|
||||
if (file.isFile() && file.canRead()) {
|
||||
|
@ -43,12 +43,6 @@ public class SpringMvcCompilerAutoConfiguration extends CompilerAutoConfiguratio
|
||||
|
||||
dependencies.add("org.codehaus.groovy", "groovy-templates",
|
||||
dependencies.getProperty("groovy.version"));
|
||||
// FIXME restore Tomcat when we can get reload to work
|
||||
// dependencies.ifMissingClasses("org.apache.catalina.startup.Tomcat")
|
||||
// .add("org.apache.tomcat.embed", "tomcat-embed-core",
|
||||
// dependencies.getProperty("tomcat.version"))
|
||||
// .add("org.apache.tomcat.embed", "tomcat-embed-logging-juli",
|
||||
// dependencies.getProperty("tomcat.version"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -37,8 +37,6 @@ public class SpringApplicationRunner {
|
||||
|
||||
private static int runnerCounter = 0;
|
||||
|
||||
// FIXME logging
|
||||
|
||||
private SpringApplicationRunnerConfiguration configuration;
|
||||
|
||||
private final File[] files;
|
||||
|
@ -32,8 +32,6 @@ import org.codehaus.groovy.control.CompilationFailedException;
|
||||
*/
|
||||
public abstract class GroovyTemplate {
|
||||
|
||||
// FIXME is this used?
|
||||
|
||||
public static String template(String name) throws IOException,
|
||||
CompilationFailedException, ClassNotFoundException {
|
||||
return template(name, Collections.<String, Object> emptyMap());
|
||||
|
@ -24,13 +24,14 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
||||
|
||||
/**
|
||||
* A Basic Spring MVC Test for the Sample Controller"
|
||||
*
|
||||
*
|
||||
* @author Biju Kunjummen
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@WebAppConfiguration
|
||||
@ContextConfiguration(classes = SampleWebUiApplication.class)
|
||||
public class MessageControllerWebTests {
|
||||
|
||||
@Autowired
|
||||
private WebApplicationContext wac;
|
||||
|
||||
|
@ -88,8 +88,8 @@ public class Repackager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Repackage to the given destination so that it can be run using '{@literal java -jar}
|
||||
* '
|
||||
* Repackage to the given destination so that it can be launched using '
|
||||
* {@literal java -jar}'
|
||||
* @param destination the destination file (may be the same as the source)
|
||||
* @param libraries the libraries required to run the archive
|
||||
* @throws IOException
|
||||
|
@ -60,7 +60,6 @@ public class LaunchedURLClassLoader extends URLClassLoader {
|
||||
/**
|
||||
* Define a package before a {@code findClass} call is made. This is necessary to
|
||||
* ensure that the appropriate manifest for nested JARs associated with the package.
|
||||
*
|
||||
* @param name the class name being found
|
||||
* @param packageName the pacakge
|
||||
*/
|
||||
|
@ -29,7 +29,6 @@ public interface RandomAccessData {
|
||||
/**
|
||||
* Returns an {@link InputStream} that can be used to read the underling data. The
|
||||
* caller is responsible close the underlying stream.
|
||||
*
|
||||
* @return a new input stream that can be used to read the underlying data.
|
||||
*/
|
||||
InputStream getInputStream();
|
||||
|
@ -33,8 +33,6 @@ import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.TemporaryFolder;
|
||||
import org.springframework.boot.loader.Archive;
|
||||
import org.springframework.boot.loader.ExplodedArchive;
|
||||
import org.springframework.boot.loader.Archive.Entry;
|
||||
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
@ -76,6 +74,7 @@ public class ExplodedArchiveTests {
|
||||
}
|
||||
}
|
||||
this.archive = new ExplodedArchive(this.rootFolder);
|
||||
jarFile.close();
|
||||
}
|
||||
|
||||
private void copy(InputStream in, OutputStream out) throws IOException {
|
||||
@ -141,6 +140,7 @@ public class ExplodedArchiveTests {
|
||||
new URL[] { filteredArchive.getUrl() });
|
||||
assertThat(classLoader.getResourceAsStream("1.dat").read(), equalTo(1));
|
||||
assertThat(classLoader.getResourceAsStream("2.dat"), nullValue());
|
||||
classLoader.close();
|
||||
}
|
||||
|
||||
private Map<String, Archive.Entry> getEntriesMap(Archive archive) {
|
||||
|
@ -34,8 +34,6 @@ import org.junit.rules.ExpectedException;
|
||||
import org.junit.rules.TemporaryFolder;
|
||||
import org.springframework.boot.loader.TestJarCreator;
|
||||
import org.springframework.boot.loader.data.RandomAccessDataFile;
|
||||
import org.springframework.boot.loader.jar.JarEntryFilter;
|
||||
import org.springframework.boot.loader.jar.RandomAccessJarFile;
|
||||
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.greaterThan;
|
||||
@ -75,6 +73,7 @@ public class RandomAccessJarFileTests {
|
||||
public void createFromFile() throws Exception {
|
||||
RandomAccessJarFile jarFile = new RandomAccessJarFile(this.rootJarFile);
|
||||
assertThat(jarFile.getName(), notNullValue(String.class));
|
||||
jarFile.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -83,6 +82,7 @@ public class RandomAccessJarFileTests {
|
||||
this.rootJarFile, 1);
|
||||
RandomAccessJarFile jarFile = new RandomAccessJarFile(randomAccessDataFile);
|
||||
assertThat(jarFile.getName(), notNullValue(String.class));
|
||||
jarFile.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -81,7 +81,7 @@ public class ServletListenerRegistrationBean<T extends EventListener> extends
|
||||
*/
|
||||
public ServletListenerRegistrationBean(T listener) {
|
||||
Assert.notNull(listener, "Listener must not be null");
|
||||
Assert.isTrue(isSupportedType(listener), "EventLisener is not a supported type");
|
||||
Assert.isTrue(isSupportedType(listener), "Listener is not of a supported type");
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
@ -91,7 +91,7 @@ public class ServletListenerRegistrationBean<T extends EventListener> extends
|
||||
*/
|
||||
public void setListener(T listener) {
|
||||
Assert.notNull(listener, "Listener must not be null");
|
||||
Assert.isTrue(isSupportedType(listener), "EventLisener is not a supported type");
|
||||
Assert.isTrue(isSupportedType(listener), "Listener is not of a supported type");
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,9 @@ import org.springframework.context.annotation.Primary;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* Tests for {@link SpringApplication} {@link SpringApplication#setSources(java.util.Set)
|
||||
* source overrides}.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*/
|
||||
public class OverrideSourcesTests {
|
||||
|
@ -24,7 +24,6 @@ import java.util.Map;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.BeanWrapperImpl;
|
||||
import org.springframework.boot.bind.RelaxedDataBinder;
|
||||
import org.springframework.boot.bind.RelaxedDataBinderTests.TargetWithNestedObject;
|
||||
import org.springframework.context.expression.MapAccessor;
|
||||
import org.springframework.core.convert.TypeDescriptor;
|
||||
|
@ -20,7 +20,6 @@ import java.util.Collections;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.boot.bind.PropertySourcesPropertyValues;
|
||||
import org.springframework.core.env.MapPropertySource;
|
||||
import org.springframework.core.env.MutablePropertySources;
|
||||
import org.springframework.core.env.PropertySource;
|
||||
@ -30,6 +29,7 @@ import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* Tests for {@link PropertySourcesPropertyValues}.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*/
|
||||
public class PropertySourcesPropertyValuesTests {
|
||||
|
@ -16,9 +16,6 @@
|
||||
|
||||
package org.springframework.boot.config;
|
||||
|
||||
import org.springframework.boot.config.JacksonJsonParser;
|
||||
import org.springframework.boot.config.JsonParser;
|
||||
|
||||
|
||||
/**
|
||||
* Tests for {@link JsonParser}.
|
||||
|
@ -16,10 +16,6 @@
|
||||
|
||||
package org.springframework.boot.config;
|
||||
|
||||
import org.springframework.boot.config.JsonParser;
|
||||
import org.springframework.boot.config.YamlJsonParser;
|
||||
|
||||
|
||||
/**
|
||||
* Tests for {@link YamlJsonParser}.
|
||||
*
|
||||
|
@ -19,7 +19,6 @@ import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.boot.config.YamlProcessor;
|
||||
import org.springframework.boot.config.YamlProcessor.MatchCallback;
|
||||
import org.springframework.core.io.ByteArrayResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
@ -27,8 +26,9 @@ import org.springframework.core.io.Resource;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
* Tests for {@link YamlProcessor}.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*/
|
||||
public class YamlProcessorTests {
|
||||
|
||||
|
@ -22,7 +22,6 @@ import java.util.Properties;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.springframework.boot.config.YamlPropertiesFactoryBean;
|
||||
import org.springframework.boot.config.YamlProcessor.DocumentMatcher;
|
||||
import org.springframework.boot.config.YamlProcessor.MatchStatus;
|
||||
import org.springframework.boot.config.YamlProcessor.ResolutionMethod;
|
||||
@ -194,7 +193,6 @@ public class YamlPropertiesFactoryBeanTests {
|
||||
"foo:\n- bar:\n spam: crap\n- baz\n- one: two\n three: four"
|
||||
.getBytes()) });
|
||||
Properties properties = factory.getObject();
|
||||
// System.err.println(properties);
|
||||
assertEquals("crap", properties.get("foo[0].bar.spam"));
|
||||
assertEquals("baz", properties.get("foo[1]"));
|
||||
assertEquals("two", properties.get("foo[2].one"));
|
||||
|
@ -16,6 +16,8 @@
|
||||
|
||||
package org.springframework.boot.context.embedded;
|
||||
|
||||
import java.util.EventListener;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.ServletContextListener;
|
||||
|
||||
@ -57,4 +59,12 @@ public class ServletListenerRegistrationBeanTests {
|
||||
verify(this.servletContext).addListener(this.listener);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void cannotRegisterUnsupportedType() throws Exception {
|
||||
this.thrown.expect(IllegalArgumentException.class);
|
||||
this.thrown.expectMessage("Listener is not of a supported type");
|
||||
new ServletListenerRegistrationBean<EventListener>(new EventListener() {
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user