Skip to content

Commit

Permalink
Polish
Browse files Browse the repository at this point in the history
  • Loading branch information
bclozel committed Nov 15, 2023
1 parent 0ef3cb9 commit 8eebb5e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
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
Expand All @@ -30,13 +31,18 @@
* @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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -38,7 +37,7 @@
*
* @author Sebastien Deleuze
*/
public class AspectJAdvisorBeanRegistrationAotProcessorTests {
class AspectJAdvisorBeanRegistrationAotProcessorTests {

private final GenerationContext generationContext = new TestGenerationContext();

Expand Down

0 comments on commit 8eebb5e

Please sign in to comment.