Spring 在未执行方面之前

Spring 在未执行方面之前,spring,maven,aop,Spring,Maven,Aop,我是SpringAOP新手,尝试在控制器类的任何方法之前配置要执行的方面。我正在使用Java8和AspectJMaven插件来编写代码 在我的pom.xml中 <dependencyManagement> <dependencies> <dependency> <groupId>io.spring.platform</groupId> <artifactId&

我是SpringAOP新手,尝试在控制器类的任何方法之前配置要执行的方面。我正在使用Java8和AspectJMaven插件来编写代码

在我的pom.xml中

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>io.spring.platform</groupId>
            <artifactId>platform-bom</artifactId>
            <version>${io.spring.platform.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

     <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-aspects</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-aop</artifactId>
    </dependency>

    <dependency>
        <groupId>org.aspectj</groupId>
        <artifactId>aspectjrt</artifactId>
    </dependency>

    <dependency>
        <groupId>org.aspectj</groupId>
        <artifactId>aspectjweaver</artifactId>
    </dependency>

    <dependency>
        <groupId>aopalliance</groupId>
        <artifactId>aopalliance</artifactId>
    </dependency>

    <build>
    <pluginManagement>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.3</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.6</version>
                <configuration>
                    <warName>usermgmt</warName>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>aspectj-maven-plugin</artifactId>
                <version>1.7</version>
                <configuration>
                    <complianceLevel>1.8</complianceLevel>
                    <encoding>UTF-8</encoding>
                    <aspectLibraries>
                        <aspectLibrary>
                            <groupId>org.springframework</groupId>
                            <artifactId>spring-aspects</artifactId>
                        </aspectLibrary>
                    </aspectLibraries>
                    <Xlint>warning</Xlint>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                            <goal>test-compile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </pluginManagement>

</build>
尽管具有所有这些配置,但在任何控制器方法之前都不会调用方面。
有人能告诉我问题出在哪里吗。提前感谢。

听起来可能很琐碎,但MyAspect类是否被上下文扫描:组件扫描?是的,它正在被扫描。
<aop:aspectj-autoproxy />
@Component
@Aspect
public class MyAspecct{

@Before("execution(* com.abc.web.controller.*.*(..))")
public void validateAuthToken(JoinPoint jointPoint){     
        // do something
}