spring boot 切面没有生效

切面没有生效,查了一圈资料还是没明白。

切面

package com.weirong.smartvault.aspect;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;

/**
 * 于2017/11/26由 KFEB4 创建 .
 * 切入任意controller中,为了动态生成菜单
 */
@Aspect
@Component
public aspect headMenu {
    @Before(value = "execution(* com.weirong.smartvault.controller.*.*(..))" )
    public void setHeader() throws Throwable {
        //String res = (String) pjp.proceed(new Object[]{model});
        //String res = (String) pjp.proceed();
        //Header header = new Header(res);
        //model.addAttribute("header",header);
        System.out.println("切面执行");
    }
}

controller

package com.weirong.smartvault.controller;

import com.weirong.smartvault.controller.fragment_entity.Header;
import com.weirong.smartvault.controller.fragment_entity.pages;
import com.weirong.smartvault.controller.temp_entity.temp_command;
import com.weirong.smartvault.dao.CommandRepository;
import com.weirong.smartvault.dao.DictRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.ArrayList;
import java.util.List;

/**
 * 于2017/11/19由 KFEB4 创建 .
 */
@Controller
public class Command {
    @Autowired
    DictRepository dictRepository;
    @Autowired
    CommandRepository commandRepository ;
    
    @RequestMapping(value = "/command/command_send_result",method =  RequestMethod.GET)
    public String command_send_result(ModelMap model, @RequestParam(value = "page",defaultValue = "0")Integer page, @RequestParam(value = "size", defaultValue = "10") Integer size){
        
        return "command/command_send_result";
    }
}

控制台输出

D:\soft\java\jdk\bin\java -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:53543,suspend=y,server=n -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dfile.encoding=UTF-8 -classpath "D:\soft\java\jdk\jre\lib\charsets.jar;D:\soft\java\jdk\jre\lib\deploy.jar;D:\soft\java\jdk\jre\lib\ext\access-bridge-64.jar;D:\soft\java\jdk\jre\lib\ext\cldrdata.jar;D:\soft\java\jdk\jre\lib\ext\dnsns.jar;D:\soft\java\jdk\jre\lib\ext\jaccess.jar;D:\soft\java\jdk\jre\lib\ext\jfxrt.jar;D:\soft\java\jdk\jre\lib\ext\localedata.jar;D:\soft\java\jdk\jre\lib\ext\nashorn.jar;D:\soft\java\jdk\jre\lib\ext\sunec.jar;D:\soft\java\jdk\jre\lib\ext\sunjce_provider.jar;D:\soft\java\jdk\jre\lib\ext\sunmscapi.jar;D:\soft\java\jdk\jre\lib\ext\sunpkcs11.jar;D:\soft\java\jdk\jre\lib\ext\zipfs.jar;D:\soft\java\jdk\jre\lib\javaws.jar;D:\soft\java\jdk\jre\lib\jce.jar;D:\soft\java\jdk\jre\lib\jfr.jar;D:\soft\java\jdk\jre\lib\jfxswt.jar;D:\soft\java\jdk\jre\lib\jsse.jar;D:\soft\java\jdk\jre\lib\management-agent.jar;D:\soft\java\jdk\jre\lib\plugin.jar;D:\soft\java\jdk\jre\lib\resources.jar;D:\soft\java\jdk\jre\lib\rt.jar;E:\RubishTest\smartvault\target\classes;C:\Users\KFEB4\.m2\repository\mysql\mysql-connector-java\5.1.44\mysql-connector-java-5.1.44.jar;C:\Users\KFEB4\.m2\repository\org\springframework\boot\spring-boot-starter-actuator\1.5.8.RELEASE\spring-boot-starter-actuator-1.5.8.RELEASE.jar;C:\Users\KFEB4\.m2\repository\org\springframework\boot\spring-boot-actuator\1.5.8.RELEASE\spring-boot-actuator-1.5.8.RELEASE.jar;C:\Users\KFEB4\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.8.10\jackson-databind-2.8.10.jar;C:\Users\KFEB4\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.8.0\jackson-annotations-2.8.0.jar;C:\Users\KFEB4\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.8.10\jackson-core-2.8.10.jar;C:\Users\KFEB4\.m2\repository\org\springframework\spring-context\4.3.12.RELEASE\spring-context-4.3.12.RELEASE.jar;C:\Users\KFEB4\.m2\repository\org\springframework\spring-expression\4.3.12.RELEASE\spring-expression-4.3.12.RELEASE.jar;C:\Users\KFEB4\.m2\repository\org\springframework\boot\spring-boot-starter-data-jpa\1.5.8.RELEASE\spring-boot-starter-data-jpa-1.5.8.RELEASE.jar;C:\Users\KFEB4\.m2\repository\org\springframework\boot\spring-boot-starter-jdbc\1.5.8.RELEASE\spring-boot-starter-jdbc-1.5.8.RELEASE.jar;C:\Users\KFEB4\.m2\repository\org\apache\tomcat\tomcat-jdbc\8.5.23\tomcat-jdbc-8.5.23.jar;C:\Users\KFEB4\.m2\repository\org\apache\tomcat\tomcat-juli\8.5.23\tomcat-juli-8.5.23.jar;C:\Users\KFEB4\.m2\repository\org\springframework\spring-jdbc\4.3.12.RELEASE\spring-jdbc-4.3.12.RELEASE.jar;C:\Users\KFEB4\.m2\repository\org\hibernate\hibernate-core\5.0.12.Final\hibernate-core-5.0.12.Final.jar;C:\Users\KFEB4\.m2\repository\org\jboss\logging\jboss-logging\3.3.1.Final\jboss-logging-3.3.1.Final.jar;C:\Users\KFEB4\.m2\repository\org\hibernate\javax\persistence\hibernate-jpa-2.1-api\1.0.0.Final\hibernate-jpa-2.1-api-1.0.0.Final.jar;C:\Users\KFEB4\.m2\repository\org\javassist\javassist\3.21.0-GA\javassist-3.21.0-GA.jar;C:\Users\KFEB4\.m2\repository\antlr\antlr\2.7.7\antlr-2.7.7.jar;C:\Users\KFEB4\.m2\repository\org\jboss\jandex\2.0.0.Final\jandex-2.0.0.Final.jar;C:\Users\KFEB4\.m2\repository\dom4j\dom4j\1.6.1\dom4j-1.6.1.jar;C:\Users\KFEB4\.m2\repository\org\hibernate\common\hibernate-commons-annotations\5.0.1.Final\hibernate-commons-annotations-5.0.1.Final.jar;C:\Users\KFEB4\.m2\repository\org\hibernate\hibernate-entitymanager\5.0.12.Final\hibernate-entitymanager-5.0.12.Final.jar;C:\Users\KFEB4\.m2\repository\javax\transaction\javax.transaction-api\1.2\javax.transaction-api-1.2.jar;C:\Users\KFEB4\.m2\repository\org\springframework\data\spring-data-jpa\1.11.8.RELEASE\spring-data-jpa-1.11.8.RELEASE.jar;C:\Users\KFEB4\.m2\repository\org\springframework\data\spring-data-commons\1.13.8.RELEASE\spring-data-commons-1.13.8.RELEASE.jar;C:\Users\KFEB4\.m2\repository\org\springframework\spring-orm\4.3.12.RELEASE\spring-orm-4.3.12.RELEASE.jar;C:\Users\KFEB4\.m2\repository\org\springframework\spring-tx\4.3.12.RELEASE\spring-tx-4.3.12.RELEASE.jar;C:\Users\KFEB4\.m2\repository\org\springframework\spring-beans\4.3.12.RELEASE\spring-beans-4.3.12.RELEASE.jar;C:\Users\KFEB4\.m2\repository\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar;C:\Users\KFEB4\.m2\repository\org\slf4j\jcl-over-slf4j\1.7.25\jcl-over-slf4j-1.7.25.jar;C:\Users\KFEB4\.m2\repository\org\springframework\spring-aspects\4.3.12.RELEASE\spring-aspects-4.3.12.RELEASE.jar;C:\Users\KFEB4\.m2\repository\org\springframework\boot\spring-boot-starter-thymeleaf\1.5.8.RELEASE\spring-boot-starter-thymeleaf-1.5.8.RELEASE.jar;C:\Users\KFEB4\.m2\repository\org\springframework\boot\spring-boot-starter-web\1.5.8.RELEASE\spring-boot-starter-web-1.5.8.RELEASE.jar;C:\Users\KFEB4\.m2\repository\org\springframework\boot\spring-boot-starter-tomcat\1.5.8.RELEASE\spring-boot-starter-tomcat-1.5.8.RELEASE.jar;C:\Users\KFEB4\.m2\repository\org\apache\tomcat\embed\tomcat-embed-core\8.5.23\tomcat-embed-core-8.5.23.jar;C:\Users\KFEB4\.m2\repository\org\apache\tomcat\tomcat-annotations-api\8.5.23\tomcat-annotations-api-8.5.23.jar;C:\Users\KFEB4\.m2\repository\org\apache\tomcat\embed\tomcat-embed-el\8.5.23\tomcat-embed-el-8.5.23.jar;C:\Users\KFEB4\.m2\repository\org\apache\tomcat\embed\tomcat-embed-websocket\8.5.23\tomcat-embed-websocket-8.5.23.jar;C:\Users\KFEB4\.m2\repository\org\hibernate\hibernate-validator\5.3.5.Final\hibernate-validator-5.3.5.Final.jar;C:\Users\KFEB4\.m2\repository\javax\validation\validation-api\1.1.0.Final\validation-api-1.1.0.Final.jar;C:\Users\KFEB4\.m2\repository\com\fasterxml\classmate\1.3.4\classmate-1.3.4.jar;C:\Users\KFEB4\.m2\repository\org\springframework\spring-web\4.3.12.RELEASE\spring-web-4.3.12.RELEASE.jar;C:\Users\KFEB4\.m2\repository\org\springframework\spring-webmvc\4.3.12.RELEASE\spring-webmvc-4.3.12.RELEASE.jar;C:\Users\KFEB4\.m2\repository\org\thymeleaf\thymeleaf-spring4\2.1.5.RELEASE\thymeleaf-spring4-2.1.5.RELEASE.jar;C:\Users\KFEB4\.m2\repository\org\thymeleaf\thymeleaf\2.1.5.RELEASE\thymeleaf-2.1.5.RELEASE.jar;C:\Users\KFEB4\.m2\repository\ognl\ognl\3.0.8\ognl-3.0.8.jar;C:\Users\KFEB4\.m2\repository\org\unbescape\unbescape\1.1.0.RELEASE\unbescape-1.1.0.RELEASE.jar;C:\Users\KFEB4\.m2\repository\nz\net\ultraq\thymeleaf\thymeleaf-layout-dialect\1.4.0\thymeleaf-layout-dialect-1.4.0.jar;C:\Users\KFEB4\.m2\repository\org\codehaus\groovy\groovy\2.4.12\groovy-2.4.12.jar;C:\Users\KFEB4\.m2\repository\org\springframework\spring-core\4.3.12.RELEASE\spring-core-4.3.12.RELEASE.jar;C:\Users\KFEB4\.m2\repository\org\springframework\boot\spring-boot-starter\1.5.8.RELEASE\spring-boot-starter-1.5.8.RELEASE.jar;C:\Users\KFEB4\.m2\repository\org\springframework\boot\spring-boot\1.5.8.RELEASE\spring-boot-1.5.8.RELEASE.jar;C:\Users\KFEB4\.m2\repository\org\springframework\boot\spring-boot-autoconfigure\1.5.8.RELEASE\spring-boot-autoconfigure-1.5.8.RELEASE.jar;C:\Users\KFEB4\.m2\repository\org\springframework\boot\spring-boot-starter-logging\1.5.8.RELEASE\spring-boot-starter-logging-1.5.8.RELEASE.jar;C:\Users\KFEB4\.m2\repository\ch\qos\logback\logback-classic\1.1.11\logback-classic-1.1.11.jar;C:\Users\KFEB4\.m2\repository\ch\qos\logback\logback-core\1.1.11\logback-core-1.1.11.jar;C:\Users\KFEB4\.m2\repository\org\slf4j\jul-to-slf4j\1.7.25\jul-to-slf4j-1.7.25.jar;C:\Users\KFEB4\.m2\repository\org\slf4j\log4j-over-slf4j\1.7.25\log4j-over-slf4j-1.7.25.jar;C:\Users\KFEB4\.m2\repository\org\yaml\snakeyaml\1.17\snakeyaml-1.17.jar;C:\Users\KFEB4\.m2\repository\org\springframework\boot\spring-boot-starter-aop\1.5.8.RELEASE\spring-boot-starter-aop-1.5.8.RELEASE.jar;C:\Users\KFEB4\.m2\repository\org\springframework\spring-aop\4.3.12.RELEASE\spring-aop-4.3.12.RELEASE.jar;C:\Users\KFEB4\.m2\repository\org\aspectj\aspectjweaver\1.8.11\aspectjweaver-1.8.11.jar;C:\Users\KFEB4\.m2\repository\org\jodd\jodd-core\3.8.5\jodd-core-3.8.5.jar;C:\Users\KFEB4\.m2\repository\org\jodd\jodd-props\3.8.5\jodd-props-3.8.5.jar;C:\Users\KFEB4\.m2\repository\org\apache\commons\commons-lang3\3.4\commons-lang3-3.4.jar;D:\soft\IntelliJ IDEA 2017.1.4\lib\idea_rt.jar" com.weirong.smartvault.SmartvaultApplication
Connected to the target VM, address: '127.0.0.1:53543', transport: 'socket'

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v1.5.8.RELEASE)

2017-11-26 14:54:56.027  INFO 11580 --- [           main] c.w.smartvault.SmartvaultApplication     : Starting SmartvaultApplication on DESKTOP-GN9604D with PID 11580 (E:\RubishTest\smartvault\target\classes started by KFEB4 in E:\RubishTest\smartvault)
2017-11-26 14:54:56.032  INFO 11580 --- [           main] c.w.smartvault.SmartvaultApplication     : No active profile set, falling back to default profiles: default
2017-11-26 14:54:56.559  INFO 11580 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@57d7f8ca: startup date [Sun Nov 26 14:54:56 CST 2017]; root of context hierarchy
2017-11-26 14:54:59.569  INFO 11580 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2017-11-26 14:54:59.583  INFO 11580 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2017-11-26 14:54:59.584  INFO 11580 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.23
2017-11-26 14:54:59.759  INFO 11580 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2017-11-26 14:54:59.759  INFO 11580 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 3205 ms
2017-11-26 14:55:00.113  INFO 11580 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Mapping servlet: 'dispatcherServlet' to [/]
2017-11-26 14:55:00.118  INFO 11580 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'metricsFilter' to: [/*]
2017-11-26 14:55:00.118  INFO 11580 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]
2017-11-26 14:55:00.119  INFO 11580 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2017-11-26 14:55:00.119  INFO 11580 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2017-11-26 14:55:00.119  INFO 11580 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*]
2017-11-26 14:55:00.119  INFO 11580 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'webRequestLoggingFilter' to: [/*]
2017-11-26 14:55:00.119  INFO 11580 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'applicationContextIdFilter' to: [/*]
2017-11-26 14:55:03.399  INFO 11580 --- [           main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2017-11-26 14:55:03.421  INFO 11580 --- [           main] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [
    name: default
    ...]
2017-11-26 14:55:03.550  INFO 11580 --- [           main] org.hibernate.Version                    : HHH000412: Hibernate Core {5.0.12.Final}
2017-11-26 14:55:03.553  INFO 11580 --- [           main] org.hibernate.cfg.Environment            : HHH000206: hibernate.properties not found
2017-11-26 14:55:03.554  INFO 11580 --- [           main] org.hibernate.cfg.Environment            : HHH000021: Bytecode provider name : javassist
2017-11-26 14:55:03.611  INFO 11580 --- [           main] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
2017-11-26 14:55:03.794  INFO 11580 --- [           main] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect
2017-11-26 14:55:04.590  INFO 11580 --- [           main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2017-11-26 14:55:05.333  INFO 11580 --- [           main] o.h.h.i.QueryTranslatorFactoryInitiator  : HHH000397: Using ASTQueryTranslatorFactory
2017-11-26 14:55:05.697  INFO 11580 --- [           main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@57d7f8ca: startup date [Sun Nov 26 14:54:56 CST 2017]; root of context hierarchy
2017-11-26 14:55:05.779  INFO 11580 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/base/org]}" onto public java.lang.String com.weirong.smartvault.controller.Base.org(org.springframework.ui.ModelMap,java.lang.Integer,java.lang.Integer)
2017-11-26 14:55:05.780  INFO 11580 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/base/add_org],methods=[GET]}" onto public java.lang.String com.weirong.smartvault.controller.Base.add_org_GET()
2017-11-26 14:55:05.781  INFO 11580 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/base/add_org],methods=[POST]}" onto public java.lang.String com.weirong.smartvault.controller.Base.add_org_POST(com.weirong.smartvault.entity.Department)
2017-11-26 14:55:05.781  INFO 11580 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/command/command_requests],methods=[GET]}" onto public java.lang.String com.weirong.smartvault.controller.Command.command_requests(org.springframework.ui.ModelMap,java.lang.Integer,java.lang.Integer)
2017-11-26 14:55:05.781  INFO 11580 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/command/command_send_result],methods=[GET]}" onto public java.lang.String com.weirong.smartvault.controller.Command.command_send_result(org.springframework.ui.ModelMap,java.lang.Integer,java.lang.Integer)
2017-11-26 14:55:05.782  INFO 11580 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/]}" onto public java.lang.String com.weirong.smartvault.controller.homepage.index(org.springframework.ui.ModelMap)
2017-11-26 14:55:05.785  INFO 11580 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2017-11-26 14:55:05.785  INFO 11580 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2017-11-26 14:55:05.834  INFO 11580 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-11-26 14:55:05.834  INFO 11580 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-11-26 14:55:05.889  INFO 11580 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-11-26 14:55:06.618  INFO 11580 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/info || /info.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2017-11-26 14:55:06.619  INFO 11580 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/trace || /trace.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2017-11-26 14:55:06.620  INFO 11580 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/dump || /dump.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2017-11-26 14:55:06.621  INFO 11580 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/env/{name:.*}],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EnvironmentMvcEndpoint.value(java.lang.String)
2017-11-26 14:55:06.621  INFO 11580 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/env || /env.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2017-11-26 14:55:06.622  INFO 11580 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/metrics/{name:.*}],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.MetricsMvcEndpoint.value(java.lang.String)
2017-11-26 14:55:06.622  INFO 11580 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/metrics || /metrics.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2017-11-26 14:55:06.623  INFO 11580 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/health || /health.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.HealthMvcEndpoint.invoke(javax.servlet.http.HttpServletRequest,java.security.Principal)
2017-11-26 14:55:06.625  INFO 11580 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/beans || /beans.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2017-11-26 14:55:06.627  INFO 11580 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/heapdump || /heapdump.json],methods=[GET],produces=[application/octet-stream]}" onto public void org.springframework.boot.actuate.endpoint.mvc.HeapdumpMvcEndpoint.invoke(boolean,javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) throws java.io.IOException,javax.servlet.ServletException
2017-11-26 14:55:06.629  INFO 11580 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/loggers/{name:.*}],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.LoggersMvcEndpoint.get(java.lang.String)
2017-11-26 14:55:06.630  INFO 11580 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/loggers/{name:.*}],methods=[POST],consumes=[application/vnd.spring-boot.actuator.v1+json || application/json],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.LoggersMvcEndpoint.set(java.lang.String,java.util.Map<java.lang.String, java.lang.String>)
2017-11-26 14:55:06.630  INFO 11580 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/loggers || /loggers.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2017-11-26 14:55:06.631  INFO 11580 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/auditevents || /auditevents.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public org.springframework.http.ResponseEntity<?> org.springframework.boot.actuate.endpoint.mvc.AuditEventsMvcEndpoint.findByPrincipalAndAfterAndType(java.lang.String,java.util.Date,java.lang.String)
2017-11-26 14:55:06.632  INFO 11580 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/mappings || /mappings.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2017-11-26 14:55:06.632  INFO 11580 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/autoconfig || /autoconfig.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2017-11-26 14:55:06.632  INFO 11580 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/configprops || /configprops.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2017-11-26 14:55:07.019  INFO 11580 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2017-11-26 14:55:07.035  INFO 11580 --- [           main] o.s.c.support.DefaultLifecycleProcessor  : Starting beans in phase 0
2017-11-26 14:55:07.164  INFO 11580 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
2017-11-26 14:55:07.170  INFO 11580 --- [           main] c.w.smartvault.SmartvaultApplication     : Started SmartvaultApplication in 11.632 seconds (JVM running for 12.631)
2017-11-26 14:55:49.085  INFO 11580 --- [nio-8080-exec-2] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring FrameworkServlet 'dispatcherServlet'
2017-11-26 14:55:49.085  INFO 11580 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization started
2017-11-26 14:55:49.118  INFO 11580 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization completed in 33 ms

网页可以正常访问,但切面就是不生效。spring boot 刚入门,求救


已经试过的方法

  1. 在启动类上添加 @EnableAspectJAutoProxy
  2. 修改切点:

    1. execution(* com.weirong.smartvault.controller.Command.command_send_result(..))
    2. execution(* com.weirong.smartvault.controller..*(..))
    3. execution(* com.weirong.smartvault.controller..*.*(..))
阅读 10.4k
4 个回答

修改headMenu这个类前面的aspect为class。

aspect这种写法是idea的增强插件,参加下面的链接。你想要用的是spring的切面,改为class就好了。
AspectJ - Help | IntelliJ IDEA

execution(* com.weirong.smartvault.controller..*(..))

"execution(* com.weirong.smartvault.controller.Command.command_send_result(..))"
先指向具体的方法看是否生效。
写切面这种东西不熟悉的情况下,首先一定要指向具体的方法测试。再逐渐往外阔,慢慢就找出问题了。

新手上路,请多包涵

你要在spring boot的启动类上边加个注解@EnableAspectJAutoProxy

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
宣传栏