Skip to content

Commit cf93d38

Browse files
committed
Added "destroyBean(Object)" method to AutowireCapableBeanFactory
Driven by the need for implementing Bean Validation 1.1's "releaseInstance" method in SpringConstraintValidatorFactory, as a direct counterpart to the use of AutowireCapableBeanFactory's "createBean(Class)" in "getInstance". Issue: SPR-8199
1 parent 853826a commit cf93d38

File tree

1 file changed

+26
-25
lines changed

1 file changed

+26
-25
lines changed

spring-test-mvc/src/main/java/org/springframework/test/web/servlet/setup/StubWebApplicationContext.java

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2013 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -22,7 +22,6 @@
2222
import java.util.Locale;
2323
import java.util.Map;
2424
import java.util.Set;
25-
2625
import javax.servlet.ServletContext;
2726

2827
import org.springframework.beans.BeansException;
@@ -290,53 +289,55 @@ public Object initializeBean(Object existingBean, String beanName) throws BeansE
290289
return existingBean;
291290
}
292291

293-
public <T> T createBean(Class<T> beanClass) throws BeansException {
294-
throw new UnsupportedOperationException("Bean creation is not supported");
292+
public <T> T createBean(Class<T> beanClass) {
293+
throw new UnsupportedOperationException();
295294
}
296295

297296
@SuppressWarnings("rawtypes")
298-
public Object createBean(Class beanClass, int autowireMode, boolean dependencyCheck) throws BeansException {
299-
throw new UnsupportedOperationException("Bean creation is not supported");
297+
public Object createBean(Class beanClass, int autowireMode, boolean dependencyCheck) {
298+
throw new UnsupportedOperationException();
300299
}
301300

302301
@SuppressWarnings("rawtypes")
303-
public Object autowire(Class beanClass, int autowireMode, boolean dependencyCheck) throws BeansException {
304-
return null;
302+
public Object autowire(Class beanClass, int autowireMode, boolean dependencyCheck) {
303+
throw new UnsupportedOperationException();
305304
}
306305

307306
public void autowireBean(Object existingBean) throws BeansException {
308-
throw new UnsupportedOperationException("Autowiring is not supported");
307+
throw new UnsupportedOperationException();
309308
}
310309

311-
public void autowireBeanProperties(Object existingBean, int autowireMode, boolean dependencyCheck) throws BeansException {
312-
throw new UnsupportedOperationException("Autowiring is not supported");
310+
public void autowireBeanProperties(Object existingBean, int autowireMode, boolean dependencyCheck) {
311+
throw new UnsupportedOperationException();
313312
}
314313

315-
public Object configureBean(Object existingBean, String beanName) throws BeansException {
316-
throw new UnsupportedOperationException("Configuring a bean is not supported");
314+
public Object configureBean(Object existingBean, String beanName) {
315+
throw new UnsupportedOperationException();
317316
}
318317

319-
public Object resolveDependency(DependencyDescriptor descriptor, String beanName) throws BeansException {
320-
throw new UnsupportedOperationException("Dependency resolution is not supported");
318+
public Object resolveDependency(DependencyDescriptor descriptor, String beanName) {
319+
throw new UnsupportedOperationException();
321320
}
322321

323-
public Object resolveDependency(DependencyDescriptor descriptor, String beanName, Set<String> autowiredBeanNames,
324-
TypeConverter typeConverter) throws BeansException {
325-
throw new UnsupportedOperationException("Dependency resolution is not supported");
322+
public Object resolveDependency(DependencyDescriptor descriptor, String beanName,
323+
Set<String> autowiredBeanNames, TypeConverter typeConverter) {
324+
throw new UnsupportedOperationException();
326325
}
327326

328327
public void applyBeanPropertyValues(Object existingBean, String beanName) throws BeansException {
329-
throw new UnsupportedOperationException("Bean property initialization is not supported");
328+
throw new UnsupportedOperationException();
329+
}
330+
331+
public Object applyBeanPostProcessorsBeforeInitialization(Object existingBean, String beanName) {
332+
throw new UnsupportedOperationException();
330333
}
331334

332-
public Object applyBeanPostProcessorsBeforeInitialization(Object existingBean, String beanName)
333-
throws BeansException {
334-
throw new UnsupportedOperationException("Post processing is not supported");
335+
public Object applyBeanPostProcessorsAfterInitialization(Object existingBean, String beanName) {
336+
throw new UnsupportedOperationException();
335337
}
336338

337-
public Object applyBeanPostProcessorsAfterInitialization(Object existingBean, String beanName)
338-
throws BeansException {
339-
throw new UnsupportedOperationException("Post processing is not supported");
339+
public void destroyBean(Object existingBean) {
340+
throw new UnsupportedOperationException();
340341
}
341342
}
342343

0 commit comments

Comments
 (0)