Clean up warnings
This commit is contained in:
parent
be3bc4c164
commit
48a507a993
|
@ -539,8 +539,7 @@ public class AutowiredAnnotationBeanPostProcessor implements SmartInstantiationA
|
|||
*/
|
||||
@SuppressWarnings({"deprecation", "cast"})
|
||||
protected boolean determineRequiredStatus(MergedAnnotation<?> ann) {
|
||||
// The following (AnnotationAttributes) cast is required on JDK 9+.
|
||||
return determineRequiredStatus((AnnotationAttributes)
|
||||
return determineRequiredStatus(
|
||||
ann.asMap(mergedAnnotation -> new AnnotationAttributes(mergedAnnotation.getType())));
|
||||
}
|
||||
|
||||
|
|
|
@ -75,7 +75,6 @@ public class AsyncAnnotationAdvisor extends AbstractPointcutAdvisor implements B
|
|||
* handle unexpected exception thrown by asynchronous method executions
|
||||
* @see AnnotationAsyncExecutionInterceptor#getDefaultExecutor(BeanFactory)
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public AsyncAnnotationAdvisor(
|
||||
@Nullable Executor executor, @Nullable AsyncUncaughtExceptionHandler exceptionHandler) {
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2021 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.
|
||||
|
@ -47,6 +47,7 @@ import org.springframework.util.Assert;
|
|||
public abstract class FooServiceImpl implements FooService {
|
||||
|
||||
// Just to test ASM5's bytecode parsing of INVOKESPECIAL/STATIC on interfaces
|
||||
@SuppressWarnings("unused")
|
||||
private static final Comparator<MessageBean> COMPARATOR_BY_MESSAGE = Comparator.comparing(MessageBean::getMessage);
|
||||
|
||||
|
||||
|
|
|
@ -48,7 +48,6 @@ import org.springframework.core.NestedRuntimeException;
|
|||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.StopWatch;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
@ -310,12 +309,6 @@ public class AspectJAutoProxyCreatorTests {
|
|||
return String.format("%s-%s", getClass().getSimpleName(), fileSuffix);
|
||||
}
|
||||
|
||||
private void assertStopWatchTimeLimit(final StopWatch sw, final long maxTimeMillis) {
|
||||
long totalTimeMillis = sw.getTotalTimeMillis();
|
||||
assertThat(totalTimeMillis < maxTimeMillis).as("'" + sw.getLastTaskName() + "' took too long: expected less than<" + maxTimeMillis +
|
||||
"> ms, actual<" + totalTimeMillis + "> ms.").isTrue();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Aspect("pertarget(execution(* *.getSpouse()))")
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2021 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.
|
||||
|
@ -513,6 +513,7 @@ public class CglibProxyTests extends AbstractAopProxyTests implements Serializab
|
|||
this.name = name;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
|
|
@ -137,6 +137,7 @@ public class AggressiveFactoryBeanInstantiationTests {
|
|||
|
||||
static class ExceptionInInitializer {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static final int ERROR = callInClinit();
|
||||
|
||||
private static int callInClinit() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2021 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.
|
||||
|
@ -1956,6 +1956,7 @@ class ConfigurationClassPostProcessorTests {
|
|||
}
|
||||
|
||||
// Unrelated, not to be considered as a factory method
|
||||
@SuppressWarnings("unused")
|
||||
private boolean testBean(boolean param) {
|
||||
return param;
|
||||
}
|
||||
|
@ -1985,6 +1986,7 @@ class ConfigurationClassPostProcessorTests {
|
|||
}
|
||||
|
||||
// Unrelated, not to be considered as a factory method
|
||||
@SuppressWarnings("unused")
|
||||
private boolean testBean(boolean param) {
|
||||
return param;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2021 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.
|
||||
|
@ -61,7 +61,7 @@ public class ParserStrategyUtilsTests {
|
|||
|
||||
@BeforeEach
|
||||
void setup() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
MockitoAnnotations.openMocks(this);
|
||||
given(this.resourceLoader.getClassLoader()).willReturn(this.beanClassLoader);
|
||||
}
|
||||
|
||||
|
|
|
@ -74,6 +74,7 @@ public class Spr12278Tests {
|
|||
private final String autowiredName;
|
||||
|
||||
// No @Autowired - implicit wiring
|
||||
@SuppressWarnings("unused")
|
||||
public SingleConstructorComponent(String autowiredName) {
|
||||
this.autowiredName = autowiredName;
|
||||
}
|
||||
|
@ -88,11 +89,13 @@ public class Spr12278Tests {
|
|||
this.name = name;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public TwoConstructorsComponent() {
|
||||
this("fallback");
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class TwoSpecificConstructorsComponent {
|
||||
|
||||
private final Integer counter;
|
||||
|
|
|
@ -70,6 +70,7 @@ public class Spr16179Tests {
|
|||
Assembler<Page<String>> assembler2;
|
||||
|
||||
@Autowired(required = false)
|
||||
@SuppressWarnings("rawtypes")
|
||||
Assembler<Page> assembler3;
|
||||
|
||||
@Autowired(required = false)
|
||||
|
|
|
@ -42,7 +42,6 @@ import org.springframework.beans.factory.config.BeanPostProcessor;
|
|||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
import org.springframework.beans.factory.config.DependencyDescriptor;
|
||||
import org.springframework.beans.factory.config.ListFactoryBean;
|
||||
import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
|
||||
import org.springframework.beans.factory.parsing.BeanDefinitionParsingException;
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.beans.factory.support.RootBeanDefinition;
|
||||
|
@ -247,7 +246,9 @@ public class ConfigurationClassProcessingTests {
|
|||
public void configurationWithPostProcessor() {
|
||||
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
|
||||
ctx.register(ConfigWithPostProcessor.class);
|
||||
RootBeanDefinition placeholderConfigurer = new RootBeanDefinition(PropertyPlaceholderConfigurer.class);
|
||||
@SuppressWarnings("deprecation")
|
||||
RootBeanDefinition placeholderConfigurer = new RootBeanDefinition(
|
||||
org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.class);
|
||||
placeholderConfigurer.getPropertyValues().add("properties", "myProp=myValue");
|
||||
ctx.registerBeanDefinition("placeholderConfigurer", placeholderConfigurer);
|
||||
ctx.refresh();
|
||||
|
@ -536,6 +537,7 @@ public class ConfigurationClassProcessingTests {
|
|||
|
||||
String nameSuffix = "-processed-" + myProp;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public void setNameSuffix(String nameSuffix) {
|
||||
this.nameSuffix = nameSuffix;
|
||||
}
|
||||
|
@ -552,10 +554,6 @@ public class ConfigurationClassProcessingTests {
|
|||
public Object postProcessAfterInitialization(Object bean, String beanName) {
|
||||
return bean;
|
||||
}
|
||||
|
||||
public int getOrder() {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2021 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.
|
||||
|
@ -25,7 +25,6 @@ import org.junit.jupiter.api.Test;
|
|||
import org.springframework.aop.support.AopUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.beans.factory.support.PropertiesBeanDefinitionReader;
|
||||
import org.springframework.beans.testfixture.beans.TestBean;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
@ -166,8 +165,10 @@ public class ImportResourceTests {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Configuration
|
||||
@ImportResource(locations = "classpath:org/springframework/context/annotation/configuration/ImportNonXmlResourceConfig-context.properties", reader = PropertiesBeanDefinitionReader.class)
|
||||
@ImportResource(locations = "classpath:org/springframework/context/annotation/configuration/ImportNonXmlResourceConfig-context.properties",
|
||||
reader = org.springframework.beans.factory.support.PropertiesBeanDefinitionReader.class)
|
||||
static class ImportNonXmlResourceConfig {
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2021 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.
|
||||
|
@ -59,6 +59,7 @@ public class ImportWithConditionTests {
|
|||
protected static class ConditionalThenUnconditional {
|
||||
|
||||
@Autowired
|
||||
@SuppressWarnings("unused")
|
||||
private BeanOne beanOne;
|
||||
}
|
||||
|
||||
|
@ -68,6 +69,7 @@ public class ImportWithConditionTests {
|
|||
protected static class UnconditionalThenConditional {
|
||||
|
||||
@Autowired
|
||||
@SuppressWarnings("unused")
|
||||
private BeanOne beanOne;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2021 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.
|
||||
|
@ -47,6 +47,7 @@ public class ImportedConfigurationClassEnhancementTests {
|
|||
autowiredConfigClassIsEnhanced(ConfigThatDoesNotImport.class, ConfigToBeAutowired.class);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private void autowiredConfigClassIsEnhanced(Class<?>... configClasses) {
|
||||
ApplicationContext ctx = new AnnotationConfigApplicationContext(configClasses);
|
||||
Config config = ctx.getBean(Config.class);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2021 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.
|
||||
|
@ -32,6 +32,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
|
||||
public class Spr7167Tests {
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Test
|
||||
public void test() {
|
||||
ConfigurableApplicationContext ctx = new AnnotationConfigApplicationContext(MyConfig.class);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2021 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.
|
||||
|
@ -22,7 +22,6 @@ import org.springframework.beans.BeansException;
|
|||
import org.springframework.beans.MutablePropertyValues;
|
||||
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
|
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor;
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
|
@ -75,6 +74,7 @@ public class BeanFactoryPostProcessorTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("deprecation")
|
||||
public void testMultipleDefinedBeanFactoryPostProcessors() {
|
||||
StaticApplicationContext ac = new StaticApplicationContext();
|
||||
ac.registerSingleton("tb1", TestBean.class);
|
||||
|
@ -84,7 +84,7 @@ public class BeanFactoryPostProcessorTests {
|
|||
ac.registerSingleton("bfpp1", TestBeanFactoryPostProcessor.class, pvs1);
|
||||
MutablePropertyValues pvs2 = new MutablePropertyValues();
|
||||
pvs2.add("properties", "key=value");
|
||||
ac.registerSingleton("bfpp2", PropertyPlaceholderConfigurer.class, pvs2);
|
||||
ac.registerSingleton("bfpp2", org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.class, pvs2);
|
||||
ac.refresh();
|
||||
TestBeanFactoryPostProcessor bfpp = (TestBeanFactoryPostProcessor) ac.getBean("bfpp1");
|
||||
assertThat(bfpp.initValue).isEqualTo("value");
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2021 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.
|
||||
|
@ -38,6 +38,7 @@ import static org.mockito.Mockito.mock;
|
|||
* @author Stephane Nicoll
|
||||
* @author Sam Brannen
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
class LiveBeansViewTests {
|
||||
|
||||
private final MockEnvironment environment = new MockEnvironment();
|
||||
|
|
|
@ -43,6 +43,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
|||
* @author Sam Brannen
|
||||
* @see org.springframework.beans.factory.config.PropertyResourceConfigurerTests
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public class PropertyResourceConfigurerIntegrationTests {
|
||||
|
||||
@Test
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2021 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.
|
||||
|
@ -46,7 +46,6 @@ import static org.springframework.beans.factory.support.BeanDefinitionBuilder.ro
|
|||
*/
|
||||
public class PropertySourcesPlaceholderConfigurerTests {
|
||||
|
||||
|
||||
@Test
|
||||
public void replacementFromEnvironmentProperties() {
|
||||
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
|
||||
|
@ -397,6 +396,7 @@ public class PropertySourcesPlaceholderConfigurerTests {
|
|||
return name;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public void setName(Optional<String> name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2021 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.
|
||||
|
@ -23,7 +23,6 @@ import java.util.Map;
|
|||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.MutablePropertyValues;
|
||||
import org.springframework.beans.factory.support.PropertiesBeanDefinitionReader;
|
||||
import org.springframework.beans.testfixture.beans.TestBean;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
|
@ -48,6 +47,7 @@ public class StaticApplicationContextMulticasterTests extends AbstractApplicatio
|
|||
|
||||
protected StaticApplicationContext sac;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
protected ConfigurableApplicationContext createContext() throws Exception {
|
||||
StaticApplicationContext parent = new StaticApplicationContext();
|
||||
|
@ -67,7 +67,8 @@ public class StaticApplicationContextMulticasterTests extends AbstractApplicatio
|
|||
sac.registerSingleton("beanThatListens", BeanThatListens.class, new MutablePropertyValues());
|
||||
sac.registerSingleton("aca", ACATester.class, new MutablePropertyValues());
|
||||
sac.registerPrototype("aca-prototype", ACATester.class, new MutablePropertyValues());
|
||||
PropertiesBeanDefinitionReader reader = new PropertiesBeanDefinitionReader(sac.getDefaultListableBeanFactory());
|
||||
org.springframework.beans.factory.support.PropertiesBeanDefinitionReader reader =
|
||||
new org.springframework.beans.factory.support.PropertiesBeanDefinitionReader(sac.getDefaultListableBeanFactory());
|
||||
Resource resource = new ClassPathResource("testBeans.properties", getClass());
|
||||
reader.loadBeanDefinitions(new EncodedResource(resource, "ISO-8859-1"));
|
||||
sac.refresh();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2021 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.
|
||||
|
@ -23,7 +23,6 @@ import java.util.Map;
|
|||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.MutablePropertyValues;
|
||||
import org.springframework.beans.factory.support.PropertiesBeanDefinitionReader;
|
||||
import org.springframework.beans.testfixture.beans.TestBean;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.testfixture.AbstractApplicationContextTests;
|
||||
|
@ -40,6 +39,7 @@ public class StaticApplicationContextTests extends AbstractApplicationContextTes
|
|||
|
||||
protected StaticApplicationContext sac;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
protected ConfigurableApplicationContext createContext() throws Exception {
|
||||
StaticApplicationContext parent = new StaticApplicationContext();
|
||||
|
@ -57,7 +57,8 @@ public class StaticApplicationContextTests extends AbstractApplicationContextTes
|
|||
sac.registerSingleton("beanThatListens", BeanThatListens.class, new MutablePropertyValues());
|
||||
sac.registerSingleton("aca", ACATester.class, new MutablePropertyValues());
|
||||
sac.registerPrototype("aca-prototype", ACATester.class, new MutablePropertyValues());
|
||||
PropertiesBeanDefinitionReader reader = new PropertiesBeanDefinitionReader(sac.getDefaultListableBeanFactory());
|
||||
org.springframework.beans.factory.support.PropertiesBeanDefinitionReader reader =
|
||||
new org.springframework.beans.factory.support.PropertiesBeanDefinitionReader(sac.getDefaultListableBeanFactory());
|
||||
reader.loadBeanDefinitions(new ClassPathResource("testBeans.properties", getClass()));
|
||||
sac.refresh();
|
||||
sac.addApplicationListener(listener);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2021 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.
|
||||
|
@ -25,7 +25,6 @@ import org.junit.jupiter.api.Disabled;
|
|||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.MutablePropertyValues;
|
||||
import org.springframework.beans.factory.support.PropertiesBeanDefinitionReader;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.MessageSourceResolvable;
|
||||
import org.springframework.context.NoSuchMessageException;
|
||||
|
@ -176,6 +175,7 @@ public class StaticMessageSourceTests extends AbstractApplicationContextTests {
|
|||
sac.getMessage(resolvable4, Locale.US));
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
protected ConfigurableApplicationContext createContext() throws Exception {
|
||||
StaticApplicationContext parent = new StaticApplicationContext();
|
||||
|
@ -197,7 +197,8 @@ public class StaticMessageSourceTests extends AbstractApplicationContextTests {
|
|||
|
||||
sac.registerPrototype("aca-prototype", ACATester.class, new MutablePropertyValues());
|
||||
|
||||
PropertiesBeanDefinitionReader reader = new PropertiesBeanDefinitionReader(sac.getDefaultListableBeanFactory());
|
||||
org.springframework.beans.factory.support.PropertiesBeanDefinitionReader reader =
|
||||
new org.springframework.beans.factory.support.PropertiesBeanDefinitionReader(sac.getDefaultListableBeanFactory());
|
||||
reader.loadBeanDefinitions(new ClassPathResource("testBeans.properties", getClass()));
|
||||
sac.refresh();
|
||||
sac.addApplicationListener(listener);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2021 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.
|
||||
|
@ -251,7 +251,7 @@ public class EnableMBeanExportConfigurationTests {
|
|||
@Bean
|
||||
@Lazy
|
||||
public Object notLoadable() throws Exception {
|
||||
return Class.forName("does.not.exist").newInstance();
|
||||
return Class.forName("does.not.exist").getDeclaredConstructor().newInstance();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2021 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.
|
||||
|
@ -39,8 +39,8 @@ import static org.springframework.core.io.buffer.DataBufferUtils.release;
|
|||
|
||||
/**
|
||||
* Abstract base class for {@link Encoder} unit tests. Subclasses need to implement
|
||||
* {@link #canEncode()} and {@link #encode()}, possibly using the wide
|
||||
* * variety of helper methods like {@link #testEncodeAll}.
|
||||
* {@link #canEncode()} and {@link #encode()}, possibly using the wide variety of
|
||||
* helper methods like {@link #testEncodeAll}.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @since 5.1.3
|
||||
|
@ -58,9 +58,7 @@ public abstract class AbstractEncoderTests<E extends Encoder<?>> extends Abstrac
|
|||
* @param encoder the encoder
|
||||
*/
|
||||
protected AbstractEncoderTests(E encoder) {
|
||||
|
||||
Assert.notNull(encoder, "Encoder must not be null");
|
||||
|
||||
this.encoder = encoder;
|
||||
}
|
||||
|
||||
|
@ -253,13 +251,11 @@ public abstract class AbstractEncoderTests<E extends Encoder<?>> extends Abstrac
|
|||
release(dataBuffer);
|
||||
assertThat(actual).isEqualTo(expected);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private <T> Encoder<T> encoder() {
|
||||
return (Encoder<T>) this.encoder;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2021 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.
|
||||
|
@ -983,6 +983,7 @@ public class HibernateTemplate implements HibernateOperations, InitializingBean
|
|||
// Convenience query methods for iteration and bulk updates/deletes
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Deprecated
|
||||
@Override
|
||||
public Iterator<?> iterate(String queryString, @Nullable Object... values) throws DataAccessException {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2021 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.
|
||||
|
@ -100,6 +100,7 @@ public class Bindings implements Iterable<Bindings.Binding> {
|
|||
* Exceptions thrown by the action are relayed to the
|
||||
* @param action the action to be performed for each {@link Binding}
|
||||
*/
|
||||
@Override
|
||||
public void forEach(Consumer<? super Binding> action) {
|
||||
this.bindings.forEach((marker, binding) -> action.accept(binding));
|
||||
}
|
||||
|
|
|
@ -180,9 +180,6 @@ public class EncoderHttpMessageWriter<T> implements HttpMessageWriter<T> {
|
|||
return main;
|
||||
}
|
||||
|
||||
private static void touch(DataBuffer buffer, Map<String, Object> hints) {
|
||||
}
|
||||
|
||||
private boolean isStreamingMediaType(@Nullable MediaType mediaType) {
|
||||
if (mediaType == null || !(this.encoder instanceof HttpMessageEncoder)) {
|
||||
return false;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2021 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.
|
||||
|
@ -44,9 +44,6 @@ public class Jackson2SmileEncoder extends AbstractJackson2Encoder {
|
|||
new MimeType("application", "x-jackson-smile"),
|
||||
new MimeType("application", "*+x-jackson-smile")};
|
||||
|
||||
private static final MimeType STREAM_MIME_TYPE =
|
||||
MediaType.parseMediaType("application/stream+x-jackson-smile");
|
||||
|
||||
private static final byte[] STREAM_SEPARATOR = new byte[0];
|
||||
|
||||
|
||||
|
|
|
@ -76,6 +76,7 @@ public class Jackson2JsonDecoderTests extends AbstractDecoderTests<Jackson2JsonD
|
|||
|
||||
@Override
|
||||
@Test
|
||||
@SuppressWarnings("deprecation")
|
||||
public void canDecode() {
|
||||
assertThat(decoder.canDecode(ResolvableType.forClass(Pojo.class), APPLICATION_JSON)).isTrue();
|
||||
assertThat(decoder.canDecode(ResolvableType.forClass(Pojo.class), APPLICATION_NDJSON)).isTrue();
|
||||
|
@ -311,6 +312,7 @@ public class Jackson2JsonDecoderTests extends AbstractDecoderTests<Jackson2JsonD
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class BeanWithNoDefaultConstructor {
|
||||
|
||||
private final String property1;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2021 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.
|
||||
|
@ -65,6 +65,7 @@ public class Jackson2JsonEncoderTests extends AbstractEncoderTests<Jackson2JsonE
|
|||
|
||||
@Override
|
||||
@Test
|
||||
@SuppressWarnings("deprecation")
|
||||
public void canEncode() {
|
||||
ResolvableType pojoType = ResolvableType.forClass(Pojo.class);
|
||||
assertThat(this.encoder.canEncode(pojoType, APPLICATION_JSON)).isTrue();
|
||||
|
@ -84,12 +85,11 @@ public class Jackson2JsonEncoderTests extends AbstractEncoderTests<Jackson2JsonE
|
|||
|
||||
// SPR-15910
|
||||
assertThat(this.encoder.canEncode(ResolvableType.forClass(Object.class), APPLICATION_OCTET_STREAM)).isFalse();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Test
|
||||
@SuppressWarnings("deprecation")
|
||||
public void encode() throws Exception {
|
||||
Flux<Object> input = Flux.just(new Pojo("foo", "bar"),
|
||||
new Pojo("foofoo", "barbar"),
|
||||
|
@ -257,7 +257,6 @@ public class Jackson2JsonEncoderTests extends AbstractEncoderTests<Jackson2JsonE
|
|||
.consumeNextWith(expectString("{\"foo\":\"foo\",\"bar\":\"bar\"}"))
|
||||
.verifyComplete(),
|
||||
new MimeType("application", "json", StandardCharsets.US_ASCII), null);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -639,10 +639,6 @@ public abstract class AbstractHandlerMethodMapping<T> extends AbstractHandlerMap
|
|||
this.registration = registration;
|
||||
}
|
||||
|
||||
public T getMapping() {
|
||||
return this.mapping;
|
||||
}
|
||||
|
||||
public HandlerMethod getHandlerMethod() {
|
||||
return this.registration.getHandlerMethod();
|
||||
}
|
||||
|
|
|
@ -64,6 +64,7 @@ public class ReactorNettyWebSocketSession
|
|||
* Constructor with an additional maxFramePayloadLength argument.
|
||||
* @since 5.1
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public ReactorNettyWebSocketSession(WebsocketInbound inbound, WebsocketOutbound outbound,
|
||||
HandshakeInfo info, NettyDataBufferFactory bufferFactory,
|
||||
int maxFramePayloadLength) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2021 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.
|
||||
|
@ -58,18 +58,21 @@ public class UndertowWebSocketHandlerAdapter extends AbstractReceiveListener {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
protected void onFullBinaryMessage(WebSocketChannel channel, BufferedBinaryMessage message) {
|
||||
this.session.handleMessage(Type.BINARY, toMessage(Type.BINARY, message.getData().getResource()));
|
||||
message.getData().free();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
protected void onFullPongMessage(WebSocketChannel channel, BufferedBinaryMessage message) {
|
||||
this.session.handleMessage(Type.PONG, toMessage(Type.PONG, message.getData().getResource()));
|
||||
message.getData().free();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
protected void onFullCloseMessage(WebSocketChannel channel, BufferedBinaryMessage message) {
|
||||
CloseMessage closeMessage = new CloseMessage(message.getData().getResource());
|
||||
this.session.handleClose(CloseStatus.create(closeMessage.getCode(), closeMessage.getReason()));
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2021 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.
|
||||
|
@ -37,12 +37,13 @@ import static org.springframework.web.testfixture.http.server.reactive.MockServe
|
|||
* @author Rossen Stoyanchev
|
||||
* @author Brian Clozel
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public class AppCacheManifestTransformerTests {
|
||||
|
||||
private static final Duration TIMEOUT = Duration.ofSeconds(5);
|
||||
|
||||
|
||||
private AppCacheManifestTransformer transformer;
|
||||
private final AppCacheManifestTransformer transformer = new AppCacheManifestTransformer();
|
||||
|
||||
private ResourceTransformerChain chain;
|
||||
|
||||
|
@ -57,7 +58,6 @@ public class AppCacheManifestTransformerTests {
|
|||
ResourceResolverChain resolverChain = new DefaultResourceResolverChain(resolvers);
|
||||
|
||||
this.chain = new DefaultResourceTransformerChain(resolverChain, Collections.emptyList());
|
||||
this.transformer = new AppCacheManifestTransformer();
|
||||
this.transformer.setResourceUrlProvider(createUrlProvider(resolvers));
|
||||
}
|
||||
|
||||
|
|
|
@ -158,6 +158,8 @@ public class ResourceUrlProviderTests {
|
|||
assertThat(parentUrlProvider.getHandlerMap()).isEmpty();
|
||||
ResourceUrlProvider childUrlProvider = childContext.getBean(ResourceUrlProvider.class);
|
||||
assertThat(childUrlProvider.getHandlerMap()).hasKeySatisfying(pathPatternStringOf("/resources/**"));
|
||||
childContext.close();
|
||||
parentContext.close();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -266,6 +266,7 @@ public class ComplexWebApplicationContext extends StaticWebApplicationContext {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public long getLastModified(HttpServletRequest request, Object delegate) {
|
||||
return ((MyHandler) delegate).lastModified();
|
||||
}
|
||||
|
@ -286,6 +287,7 @@ public class ComplexWebApplicationContext extends StaticWebApplicationContext {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public long getLastModified(HttpServletRequest request, Object delegate) {
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2021 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.
|
||||
|
@ -33,7 +33,6 @@ import org.springframework.web.accept.ContentNegotiationManager;
|
|||
import org.springframework.web.context.support.GenericWebApplicationContext;
|
||||
import org.springframework.web.servlet.HandlerMapping;
|
||||
import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping;
|
||||
import org.springframework.web.servlet.resource.AppCacheManifestTransformer;
|
||||
import org.springframework.web.servlet.resource.CachingResourceResolver;
|
||||
import org.springframework.web.servlet.resource.CachingResourceTransformer;
|
||||
import org.springframework.web.servlet.resource.CssLinkResourceTransformer;
|
||||
|
@ -163,13 +162,14 @@ public class ResourceHandlerRegistryTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("deprecation")
|
||||
public void resourceChainWithVersionResolver() throws Exception {
|
||||
VersionResourceResolver versionResolver = new VersionResourceResolver()
|
||||
.addFixedVersionStrategy("fixed", "/**/*.js")
|
||||
.addContentVersionStrategy("/**");
|
||||
|
||||
this.registration.resourceChain(true).addResolver(versionResolver)
|
||||
.addTransformer(new AppCacheManifestTransformer());
|
||||
.addTransformer(new org.springframework.web.servlet.resource.AppCacheManifestTransformer());
|
||||
|
||||
ResourceHttpRequestHandler handler = getHandler("/resources/**");
|
||||
List<ResourceResolver> resolvers = handler.getResourceResolvers();
|
||||
|
@ -183,17 +183,19 @@ public class ResourceHandlerRegistryTests {
|
|||
assertThat(transformers).hasSize(3);
|
||||
assertThat(transformers.get(0)).isInstanceOf(CachingResourceTransformer.class);
|
||||
assertThat(transformers.get(1)).isInstanceOf(CssLinkResourceTransformer.class);
|
||||
assertThat(transformers.get(2)).isInstanceOf(AppCacheManifestTransformer.class);
|
||||
assertThat(transformers.get(2)).isInstanceOf(org.springframework.web.servlet.resource.AppCacheManifestTransformer.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("deprecation")
|
||||
public void resourceChainWithOverrides() throws Exception {
|
||||
CachingResourceResolver cachingResolver = Mockito.mock(CachingResourceResolver.class);
|
||||
VersionResourceResolver versionResolver = Mockito.mock(VersionResourceResolver.class);
|
||||
WebJarsResourceResolver webjarsResolver = Mockito.mock(WebJarsResourceResolver.class);
|
||||
PathResourceResolver pathResourceResolver = new PathResourceResolver();
|
||||
CachingResourceTransformer cachingTransformer = Mockito.mock(CachingResourceTransformer.class);
|
||||
AppCacheManifestTransformer appCacheTransformer = Mockito.mock(AppCacheManifestTransformer.class);
|
||||
org.springframework.web.servlet.resource.AppCacheManifestTransformer appCacheTransformer =
|
||||
Mockito.mock(org.springframework.web.servlet.resource.AppCacheManifestTransformer.class);
|
||||
CssLinkResourceTransformer cssLinkTransformer = new CssLinkResourceTransformer();
|
||||
|
||||
this.registration.setCachePeriod(3600)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2021 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.
|
||||
|
@ -38,9 +38,10 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
* @author Brian Clozel
|
||||
* @author Rossen Stoyanchev
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public class AppCacheManifestTransformerTests {
|
||||
|
||||
private AppCacheManifestTransformer transformer;
|
||||
private final AppCacheManifestTransformer transformer = new AppCacheManifestTransformer();
|
||||
|
||||
private ResourceTransformerChain chain;
|
||||
|
||||
|
@ -59,7 +60,6 @@ public class AppCacheManifestTransformerTests {
|
|||
ResourceResolverChain resolverChain = new DefaultResourceResolverChain(resolvers);
|
||||
|
||||
this.chain = new DefaultResourceTransformerChain(resolverChain, Collections.emptyList());
|
||||
this.transformer = new AppCacheManifestTransformer();
|
||||
this.transformer.setResourceUrlProvider(createUrlProvider(resolvers));
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2021 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.
|
||||
|
@ -34,7 +34,6 @@ import org.springframework.web.accept.FixedContentNegotiationStrategy;
|
|||
import org.springframework.web.accept.HeaderContentNegotiationStrategy;
|
||||
import org.springframework.web.accept.MappingMediaTypeFileExtensionResolver;
|
||||
import org.springframework.web.accept.ParameterContentNegotiationStrategy;
|
||||
import org.springframework.web.accept.PathExtensionContentNegotiationStrategy;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
import org.springframework.web.context.support.StaticWebApplicationContext;
|
||||
|
@ -312,11 +311,12 @@ public class ContentNegotiatingViewResolverTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("deprecation")
|
||||
public void resolveViewNameFilename() throws Exception {
|
||||
request.setRequestURI("/test.html");
|
||||
|
||||
ContentNegotiationManager manager =
|
||||
new ContentNegotiationManager(new PathExtensionContentNegotiationStrategy());
|
||||
new ContentNegotiationManager(new org.springframework.web.accept.PathExtensionContentNegotiationStrategy());
|
||||
|
||||
ViewResolver viewResolverMock1 = mock(ViewResolver.class, "viewResolver1");
|
||||
ViewResolver viewResolverMock2 = mock(ViewResolver.class, "viewResolver2");
|
||||
|
@ -348,7 +348,8 @@ public class ContentNegotiatingViewResolverTests {
|
|||
request.setRequestURI("/test.json");
|
||||
|
||||
Map<String, MediaType> mapping = Collections.singletonMap("json", MediaType.APPLICATION_JSON);
|
||||
PathExtensionContentNegotiationStrategy pathStrategy = new PathExtensionContentNegotiationStrategy(mapping);
|
||||
org.springframework.web.accept.PathExtensionContentNegotiationStrategy pathStrategy =
|
||||
new org.springframework.web.accept.PathExtensionContentNegotiationStrategy(mapping);
|
||||
viewResolver.setContentNegotiationManager(new ContentNegotiationManager(pathStrategy));
|
||||
|
||||
ViewResolver viewResolverMock1 = mock(ViewResolver.class);
|
||||
|
|
Loading…
Reference in New Issue