Skip to content

Commit 325d883

Browse files
jhoellerunknown
authored andcommitted
Polishing
1 parent 0c76cb7 commit 325d883

File tree

2 files changed

+22
-29
lines changed

2 files changed

+22
-29
lines changed

spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJWeaverMessageHandler.java

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,43 +45,41 @@ public class AspectJWeaverMessageHandler implements IMessageHandler {
4545

4646
private static final String AJ_ID = "[AspectJ] ";
4747

48-
private static final Log LOGGER = LogFactory.getLog("AspectJ Weaver");
48+
private static final Log logger = LogFactory.getLog("AspectJ Weaver");
4949

5050

5151
public boolean handleMessage(IMessage message) throws AbortException {
5252
Kind messageKind = message.getKind();
53-
5453
if (messageKind == IMessage.DEBUG) {
55-
if (LOGGER.isDebugEnabled() || LOGGER.isTraceEnabled()) {
56-
LOGGER.debug(makeMessageFor(message));
54+
if (logger.isDebugEnabled()) {
55+
logger.debug(makeMessageFor(message));
5756
return true;
5857
}
5958
}
60-
else if ((messageKind == IMessage.INFO) || (messageKind == IMessage.WEAVEINFO)) {
61-
if (LOGGER.isInfoEnabled()) {
62-
LOGGER.info(makeMessageFor(message));
59+
else if (messageKind == IMessage.INFO || messageKind == IMessage.WEAVEINFO) {
60+
if (logger.isInfoEnabled()) {
61+
logger.info(makeMessageFor(message));
6362
return true;
6463
}
6564
}
6665
else if (messageKind == IMessage.WARNING) {
67-
if (LOGGER.isWarnEnabled()) {
68-
LOGGER.warn(makeMessageFor(message));
66+
if (logger.isWarnEnabled()) {
67+
logger.warn(makeMessageFor(message));
6968
return true;
7069
}
7170
}
7271
else if (messageKind == IMessage.ERROR) {
73-
if (LOGGER.isErrorEnabled()) {
74-
LOGGER.error(makeMessageFor(message));
72+
if (logger.isErrorEnabled()) {
73+
logger.error(makeMessageFor(message));
7574
return true;
7675
}
7776
}
7877
else if (messageKind == IMessage.ABORT) {
79-
if (LOGGER.isFatalEnabled()) {
80-
LOGGER.fatal(makeMessageFor(message));
78+
if (logger.isFatalEnabled()) {
79+
logger.fatal(makeMessageFor(message));
8180
return true;
8281
}
8382
}
84-
8583
return false;
8684
}
8785

spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ public AbstractAutowireCapableBeanFactory(BeanFactory parentBeanFactory) {
171171
setParentBeanFactory(parentBeanFactory);
172172
}
173173

174+
174175
/**
175176
* Set the instantiation strategy to use for creating bean instances.
176177
* Default is CglibSubclassingInstantiationStrategy.
@@ -261,7 +262,6 @@ public void ignoreDependencyInterface(Class<?> ifc) {
261262
this.ignoredDependencyInterfaces.add(ifc);
262263
}
263264

264-
265265
@Override
266266
public void copyConfigurationFrom(ConfigurableBeanFactory otherFactory) {
267267
super.copyConfigurationFrom(otherFactory);
@@ -346,7 +346,6 @@ public Object autowire(Class<?> beanClass, int autowireMode, boolean dependencyC
346346
else {
347347
Object bean;
348348
final BeanFactory parent = this;
349-
350349
if (System.getSecurityManager() != null) {
351350
bean = AccessController.doPrivileged(new PrivilegedAction<Object>() {
352351
public Object run() {
@@ -357,7 +356,6 @@ public Object run() {
357356
else {
358357
bean = getInstantiationStrategy().instantiate(bd, null, parent);
359358
}
360-
361359
populateBean(beanClass.getName(), bd, new BeanWrapperImpl(bean));
362360
return bean;
363361
}
@@ -687,22 +685,19 @@ class Holder { Class<?> value = null; }
687685
// Try to obtain the FactoryBean's object type without instantiating it at all.
688686
BeanDefinition fbDef = getBeanDefinition(factoryBeanName);
689687
if (fbDef instanceof AbstractBeanDefinition && ((AbstractBeanDefinition) fbDef).hasBeanClass()) {
690-
Class<?> fbClass = ((AbstractBeanDefinition) fbDef).getBeanClass();
691-
if (ClassUtils.isCglibProxyClass(fbClass)) {
692-
// CGLIB subclass methods hide generic parameters. look at the superclass.
693-
fbClass = fbClass.getSuperclass();
694-
}
688+
// CGLIB subclass methods hide generic parameters; look at the original user class.
689+
Class<?> fbClass = ClassUtils.getUserClass(((AbstractBeanDefinition) fbDef).getBeanClass());
695690
// Find the given factory method, taking into account that in the case of
696691
// @Bean methods, there may be parameters present.
697692
ReflectionUtils.doWithMethods(fbClass,
698-
new ReflectionUtils.MethodCallback() {
699-
public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException {
700-
if (method.getName().equals(factoryMethodName) &&
701-
FactoryBean.class.isAssignableFrom(method.getReturnType())) {
702-
objectType.value = GenericTypeResolver.resolveReturnTypeArgument(method, FactoryBean.class);
693+
new ReflectionUtils.MethodCallback() {
694+
public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException {
695+
if (method.getName().equals(factoryMethodName) &&
696+
FactoryBean.class.isAssignableFrom(method.getReturnType())) {
697+
objectType.value = GenericTypeResolver.resolveReturnTypeArgument(method, FactoryBean.class);
698+
}
703699
}
704-
}
705-
});
700+
});
706701
if (objectType.value != null) {
707702
return objectType.value;
708703
}

0 commit comments

Comments
 (0)