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