Browse Source

Polish

See gh-31575
pull/31309/merge
Brian Clozel 10 months ago
parent
commit
8eebb5e27b
  1. 14
      spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/AspectJAdvisorBeanRegistrationAotProcessor.java
  2. 5
      spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AspectJAdvisorBeanRegistrationAotProcessorTests.java

14
spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/AspectJAdvisorBeanRegistrationAotProcessor.java

@ -22,6 +22,7 @@ import org.springframework.beans.factory.aot.BeanRegistrationAotContribution; @@ -22,6 +22,7 @@ import org.springframework.beans.factory.aot.BeanRegistrationAotContribution;
import org.springframework.beans.factory.aot.BeanRegistrationAotProcessor;
import org.springframework.beans.factory.aot.BeanRegistrationCode;
import org.springframework.beans.factory.support.RegisteredBean;
import org.springframework.util.ClassUtils;
/**
* An AOT {@link BeanRegistrationAotProcessor} that detects the presence of
@ -30,13 +31,18 @@ import org.springframework.beans.factory.support.RegisteredBean; @@ -30,13 +31,18 @@ import org.springframework.beans.factory.support.RegisteredBean;
* @author Sebastien Deleuze
* @since 6.1
*/
public class AspectJAdvisorBeanRegistrationAotProcessor implements BeanRegistrationAotProcessor {
class AspectJAdvisorBeanRegistrationAotProcessor implements BeanRegistrationAotProcessor {
private static final boolean aspectJPresent = ClassUtils.isPresent("org.aspectj.lang.annotation.Pointcut",
AspectJAdvisorBeanRegistrationAotProcessor.class.getClassLoader());
@Override
public BeanRegistrationAotContribution processAheadOfTime(RegisteredBean registeredBean) {
Class<?> beanClass = registeredBean.getBeanClass();
if (AbstractAspectJAdvisorFactory.compiledByAjc(beanClass)) {
return new AspectJAdvisorContribution(beanClass);
if (aspectJPresent) {
Class<?> beanClass = registeredBean.getBeanClass();
if (AbstractAspectJAdvisorFactory.compiledByAjc(beanClass)) {
return new AspectJAdvisorContribution(beanClass);
}
}
return null;
}

5
spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJAdvisorBeanRegistrationAotProcessorTests.java → spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AspectJAdvisorBeanRegistrationAotProcessorTests.java

@ -14,11 +14,10 @@ @@ -14,11 +14,10 @@
* limitations under the License.
*/
package org.springframework.aop.aspectj;
package org.springframework.aop.aspectj.annotation;
import org.junit.jupiter.api.Test;
import org.springframework.aop.aspectj.annotation.AspectJAdvisorBeanRegistrationAotProcessor;
import org.springframework.aot.generate.GenerationContext;
import org.springframework.aot.hint.MemberCategory;
import org.springframework.aot.hint.RuntimeHints;
@ -38,7 +37,7 @@ import static org.springframework.aot.hint.predicate.RuntimeHintsPredicates.refl @@ -38,7 +37,7 @@ import static org.springframework.aot.hint.predicate.RuntimeHintsPredicates.refl
*
* @author Sebastien Deleuze
*/
public class AspectJAdvisorBeanRegistrationAotProcessorTests {
class AspectJAdvisorBeanRegistrationAotProcessorTests {
private final GenerationContext generationContext = new TestGenerationContext();
Loading…
Cancel
Save