Clean up warnings across code base
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
@@ -13,16 +13,18 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.beans.factory.aspectj;
|
||||
|
||||
/**
|
||||
* Generic-based dependency injection aspect.
|
||||
* <p>
|
||||
* This aspect allows users to implement efficient, type-safe dependency injection without
|
||||
* the use of the @Configurable annotation.
|
||||
*
|
||||
* The subaspect of this aspect doesn't need to include any AOP constructs.
|
||||
* For example, here is a subaspect that configures the {@code PricingStrategyClient} objects.
|
||||
* <p>This aspect allows users to implement efficient, type-safe dependency injection
|
||||
* without the use of the {@code @Configurable} annotation.
|
||||
*
|
||||
* <p>The subaspect of this aspect doesn't need to include any AOP constructs. For
|
||||
* example, here is a subaspect that configures the {@code PricingStrategyClient} objects.
|
||||
*
|
||||
* <pre class="code">
|
||||
* aspect PricingStrategyDependencyInjectionAspect
|
||||
* extends GenericInterfaceDrivenDependencyInjectionAspect<PricingStrategyClient> {
|
||||
@@ -35,20 +37,23 @@ package org.springframework.beans.factory.aspectj;
|
||||
* public void setPricingStrategy(PricingStrategy pricingStrategy) {
|
||||
* this.pricingStrategy = pricingStrategy;
|
||||
* }
|
||||
* }
|
||||
* </pre>
|
||||
* }</pre>
|
||||
*
|
||||
* @author Ramnivas Laddad
|
||||
* @since 3.0.0
|
||||
* @since 3.0
|
||||
*/
|
||||
public abstract aspect GenericInterfaceDrivenDependencyInjectionAspect<I> extends AbstractInterfaceDrivenDependencyInjectionAspect {
|
||||
declare parents: I implements ConfigurableObject;
|
||||
|
||||
declare parents: I implements ConfigurableObject;
|
||||
|
||||
public pointcut inConfigurableBean() : within(I+);
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public final void configureBean(Object bean) {
|
||||
configure((I)bean);
|
||||
configure((I) bean);
|
||||
}
|
||||
|
||||
// Unfortunately, erasure used with generics won't allow to use the same named method
|
||||
protected abstract void configure(I bean);
|
||||
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import org.aspectj.lang.annotation.SuppressAjWarnings;
|
||||
*/
|
||||
public aspect CodeStyleAspect {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private String foo;
|
||||
|
||||
pointcut somePC() : call(* someMethod());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
@@ -16,22 +16,25 @@
|
||||
|
||||
package org.springframework.beans.factory.aspectj;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* @author Chris Beams
|
||||
*/
|
||||
public class XmlBeanConfigurerTests {
|
||||
|
||||
@Test
|
||||
public void testInjection() {
|
||||
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
"org/springframework/beans/factory/aspectj/beanConfigurerTests.xml");
|
||||
ShouldBeConfiguredBySpring myObject = new ShouldBeConfiguredBySpring();
|
||||
Assert.assertEquals("Rod", myObject.getName());
|
||||
public void injection() {
|
||||
try (ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
"org/springframework/beans/factory/aspectj/beanConfigurerTests.xml")) {
|
||||
|
||||
ShouldBeConfiguredBySpring myObject = new ShouldBeConfiguredBySpring();
|
||||
assertEquals("Rod", myObject.getName());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package org.springframework.context.annotation.aspectj;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.beans.factory.aspectj.ShouldBeConfiguredBySpring;
|
||||
@@ -24,6 +23,8 @@ import org.springframework.context.annotation.AnnotationConfigApplicationContext
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.ImportResource;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Tests that @EnableSpringConfigured properly registers an
|
||||
* {@link org.springframework.beans.factory.aspectj.AnnotationBeanConfigurerAspect},
|
||||
@@ -35,10 +36,11 @@ import org.springframework.context.annotation.ImportResource;
|
||||
public class AnnotationBeanConfigurerTests {
|
||||
|
||||
@Test
|
||||
public void testInjection() {
|
||||
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(Config.class);
|
||||
ShouldBeConfiguredBySpring myObject = new ShouldBeConfiguredBySpring();
|
||||
Assert.assertEquals("Rod", myObject.getName());
|
||||
public void injection() {
|
||||
try (AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(Config.class)) {
|
||||
ShouldBeConfiguredBySpring myObject = new ShouldBeConfiguredBySpring();
|
||||
assertEquals("Rod", myObject.getName());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user