The solution to "IDEA cannot resolve @Aspect annotations"

problem causes:

The following two jar packages are not introduced in the project lib:
insert image description here

Solution:

1. Download AspectJ-related jar packages from the official website
Link: https://www.eclipse.org/aspectj/downloads.php .
insert image description here
2. After installing the jar packages, copy the two jar packages at the beginning of the article to the lib of the project.
insert image description here
3. To develop AspectJ in the professional version of IDEA, you need to ensure that the following plug-ins are activated:

  • Spring AOP/@AspectJ
  • AspectJ Support

Open setting—plugins—search for Aspect
insert image description here
4. Then perform the following operations to add the Jar package to the project dependencies:

  1. Open Project Structurethe dialog (Ctrl+Shift+Alt+S).
  2. Corresponding to creating a project-level or IDE-level library, select Librariesor respectively Global Libraries.
  3. Click on the + sign and select java.
  4. In the pop-up dialog box, select the file in the lib directory we just added to the project aspectjrt.jar.
  5. Finally click the OK button.

insert image description here

Guess you like

Origin blog.csdn.net/qq_47354826/article/details/120686830