您的位置:首页 > 编程语言 > Java开发

spring boot aop拦截Controller失败

2018-01-19 17:54 323 查看
 java.lang.IllegalAccessError: tried to access class cn.xiaozhitech.controller.mode.Hello from class cn.xiaozhitech.controller.mode.HelloController$$FastClassBySpringCGLIB$$14914816] with root cause 失败原因
-------------------------
@Aspect
@Component
public class ControllerLogAOP {

@Pointcut(value="execution(public * cn.xiaozhitech.service.mode.*.*(..))")  
    public void pointCuts(){} 
@Before("pointCuts")
public void before(){
System.out.println("success****************************************");
}
}
-----------------------------------controller类@RestController
public class HelloController {

@RequestMapping(value="/hello",consumes=MediaType.APPLICATION_JSON_VALUE,method=RequestMethod.POST)
@ResponseBody
public String hello(Integer i, @RequestBody Hello hello) throws IOException{

try {
helloService.getHello();
} catch (DataProcessException e) {
return e.getResponseString();
}

return JSON.toJSONString(hello);
}
}
-------------------启动类@SpringBootApplication
@EnableAspectJAutoProxy(exposeProxy=true)
public class Application {

public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  java aop