Fix warnings

This commit is contained in:
Phillip Webb 2015-09-05 00:21:09 -07:00
parent 85bb347fba
commit 690da89c82
22 changed files with 8 additions and 72 deletions

View File

@ -16,14 +16,11 @@
package org.springframework.boot.actuate.hypermedia;
import groovy.text.TemplateEngine;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.actuate.endpoint.mvc.MvcEndpoints;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.http.MediaType;
import org.springframework.test.annotation.DirtiesContext;
@ -50,12 +47,6 @@ public class HealthEndpointDocumentation {
@Autowired
private WebApplicationContext context;
@Autowired
private MvcEndpoints mvcEndpoints;
@Autowired
private TemplateEngine templates;
@Value("${org.springframework.restdocs.outputDir:target/generated-snippets}")
private String restdocsOutputDir;

View File

@ -16,14 +16,11 @@
package org.springframework.boot.actuate.hypermedia;
import groovy.text.TemplateEngine;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.actuate.endpoint.mvc.MvcEndpoints;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.http.MediaType;
import org.springframework.test.annotation.DirtiesContext;
@ -49,12 +46,6 @@ public class HypermediaEndpointDocumentation {
@Autowired
private WebApplicationContext context;
@Autowired
private MvcEndpoints mvcEndpoints;
@Autowired
private TemplateEngine templates;
@Value("${org.springframework.restdocs.outputDir:target/generated-snippets}")
private String restdocsOutputDir;

View File

@ -82,9 +82,6 @@ public class EndpointWebMvcChildContextConfiguration {
@Value("${error.path:/error}")
private String errorPath = "/error";
@Autowired
private ManagementServerProperties managementServerProperties;
@Bean(name = DispatcherServletAutoConfiguration.DEFAULT_DISPATCHER_SERVLET_BEAN_NAME)
public DispatcherServlet dispatcherServlet() {
DispatcherServlet dispatcherServlet = new DispatcherServlet();

View File

@ -67,7 +67,6 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonUnwrapped;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
@ -219,17 +218,11 @@ public class EndpointWebMvcHypermediaManagementContextConfiguration {
@ControllerAdvice(assignableTypes = MvcEndpoint.class)
public static class MvcEndpointAdvice implements ResponseBodyAdvice<Object> {
@Autowired
private ManagementServerProperties management;
@Autowired
private HttpMessageConverters converters;
private Map<MediaType, HttpMessageConverter<?>> converterCache = new ConcurrentHashMap<MediaType, HttpMessageConverter<?>>();
@Autowired
private ObjectMapper mapper;
@Override
public boolean supports(MethodParameter returnType,
Class<? extends HttpMessageConverter<?>> converterType) {

View File

@ -41,7 +41,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.SpringBootCondition;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.context.annotation.Conditional;
@ -62,9 +61,6 @@ import org.springframework.web.cors.CorsConfiguration;
EndpointCorsProperties.class })
public class EndpointWebMvcManagementContextConfiguration {
@Autowired
private ApplicationContext applicationContext;
@Autowired
private HealthMvcEndpointProperties healthMvcEndpointProperties;

View File

@ -22,7 +22,6 @@ import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.autoconfigure.BrowserPathHypermediaIntegrationTests.SpringBootHypermediaApplication;
import org.springframework.boot.actuate.endpoint.mvc.ActuatorHalBrowserEndpoint;
import org.springframework.boot.actuate.endpoint.mvc.MvcEndpoints;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
@ -57,9 +56,6 @@ public class BrowserPathHypermediaIntegrationTests {
@Autowired
private WebApplicationContext context;
@Autowired
private MvcEndpoints mvcEndpoints;
private MockMvc mockMvc;
@Before

View File

@ -20,8 +20,6 @@ import java.util.Map;
import org.junit.After;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.ConfigurationBeanFactoryMetaData;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.ConfigurableApplicationContext;
@ -115,9 +113,6 @@ public class ConfigurationPropertiesReportEndpointParentTests {
@EnableConfigurationProperties
public static class Factory {
@Autowired
private ConfigurationBeanFactoryMetaData beanFactoryMetaData;
@Bean
public ConfigurationPropertiesReportEndpoint endpoint() {
return new ConfigurationPropertiesReportEndpoint();

View File

@ -55,9 +55,6 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
@WebAppConfiguration
public class JolokiaMvcEndpointContextPathTests {
@Autowired
private MvcEndpoints endpoints;
@Autowired
private WebApplicationContext context;

View File

@ -29,7 +29,6 @@ import javax.ws.rs.ApplicationPath;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.servlet.ServletContainer;
import org.glassfish.jersey.servlet.ServletProperties;
import org.springframework.beans.factory.ListableBeanFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.AutoConfigureOrder;
@ -71,9 +70,6 @@ public class JerseyAutoConfiguration implements WebApplicationInitializer {
@Autowired
private JerseyProperties jersey;
@Autowired
private ListableBeanFactory context;
@Autowired
private ResourceConfig config;

View File

@ -69,9 +69,6 @@ public class AuthenticationManagerConfiguration {
private static Log logger = LogFactory
.getLog(AuthenticationManagerConfiguration.class);
@Autowired
private List<SecurityPrerequisite> dependencies;
@Bean
@Primary
public AuthenticationManager authenticationManager(
@ -97,9 +94,8 @@ public class AuthenticationManagerConfiguration {
* {@link GlobalAuthenticationConfigurerAdapter#init(AuthenticationManagerBuilder)}
* exists that adds a {@link SecurityConfigurer} to the
* {@link AuthenticationManagerBuilder}.</li>
* <li>
* {@link AuthenticationManagerConfiguration#init(AuthenticationManagerBuilder)} adds
* {@link SpringBootAuthenticationConfigurerAdapter} so it is after the
* <li>{@link AuthenticationManagerConfiguration#init(AuthenticationManagerBuilder)}
* adds {@link SpringBootAuthenticationConfigurerAdapter} so it is after the
* {@link SecurityConfigurer} in the first step.</li>
* <li>We then can default an {@link AuthenticationProvider} if necessary. Note we can
* only invoke the

View File

@ -44,7 +44,7 @@ import static org.mockito.Mockito.mock;
public class MockCachingProvider implements CachingProvider {
@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
@SuppressWarnings({ "rawtypes", "unchecked" })
public CacheManager getCacheManager(URI uri, ClassLoader classLoader,
Properties properties) {
CacheManager cacheManager = mock(CacheManager.class);

View File

@ -272,7 +272,6 @@ public class DataSourceAutoConfigurationTests {
}
@SuppressWarnings("unused")
// see testExplicitDriverClassClearsUserName
public static class DatabaseDriver implements Driver {

View File

@ -41,7 +41,6 @@ import org.junit.After;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.jms.JmsAutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.test.EnvironmentTestUtils;
@ -402,9 +401,6 @@ public class HornetQAutoConfigurationTests {
@Configuration
protected static class CustomHornetQConfiguration {
@Autowired
private HornetQProperties properties;
@Bean
public HornetQConfigurationCustomizer myHornetQCustomize() {
return new HornetQConfigurationCustomizer() {

View File

@ -402,7 +402,7 @@ public class SecurityAutoConfigurationTests {
protected static class SecurityCustomizer extends WebSecurityConfigurerAdapter {
@Autowired
private AuthenticationManager authenticationManager;
AuthenticationManager authenticationManager;
}

View File

@ -31,7 +31,7 @@ import org.springframework.security.config.annotation.method.configuration.Enabl
public class SecurityConfig extends GlobalAuthenticationConfigurerAdapter {
@Autowired
private UserRepository userRepository;
protected UserRepository userRepository;
@Override
public void init(AuthenticationManagerBuilder auth) throws Exception {

View File

@ -26,7 +26,6 @@ import org.junit.After;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext;
import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory;
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
@ -257,9 +256,6 @@ public class MultipartAutoConfigurationTests {
@EnableConfigurationProperties(MultipartProperties.class)
protected static class BaseConfiguration {
@Autowired
private MultipartProperties properties;
@Bean
public ServerProperties serverProperties() {
ServerProperties properties = new ServerProperties();

View File

@ -468,7 +468,6 @@ public class WebMvcAutoConfigurationTests {
is(instanceOf(CustomWebBindingInitializer.class)));
}
@SuppressWarnings("unchecked")
private void load(Class<?> config, String... environment) {
this.context = new AnnotationConfigEmbeddedWebApplicationContext();
EnvironmentTestUtils.addEnvironment(this.context, environment);

View File

@ -121,7 +121,6 @@ public class AetherGrapeEngineTests {
});
}
@SuppressWarnings("unchecked")
@Test
public void dependencyResolutionWithExclusions() {
Map<String, Object> args = new HashMap<String, Object>();

View File

@ -242,7 +242,6 @@ public class RandomAccessDataFile implements RandomAccessData {
this.files = new ConcurrentLinkedQueue<RandomAccessFile>();
}
@SuppressWarnings("resource")
public RandomAccessFile acquire() throws IOException {
try {
this.available.acquire();

View File

@ -72,7 +72,6 @@ class DefaultLogbackConfiguration {
return new RelaxedPropertyResolver(environment, "logging.pattern.");
}
@SuppressWarnings("unchecked")
public void apply(LogbackConfigurator config) {
synchronized (config.getConfigurationLock()) {
base(config);

View File

@ -94,7 +94,8 @@ class LogbackConfigurator {
}
}
public void root(Level level, Appender<ILoggingEvent>... appenders) {
@SafeVarargs
public final void root(Level level, Appender<ILoggingEvent>... appenders) {
Logger logger = this.context.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME);
if (level != null) {
logger.setLevel(level);

View File

@ -170,7 +170,7 @@ public class EntityScanTests {
static class BeanPostProcessorConfiguration {
@Autowired
private EntityManagerFactory entityManagerFactory;
protected EntityManagerFactory entityManagerFactory;
@Bean
public BeanPostProcessor beanPostProcessor() {