error Type referred to is not an annotation type 一个解决办法
2018-03-30 09:50
441 查看
最近使用aop想做校验权限功能发现一个问题-->
error Type referred to is not an annotation type: AuthToken
以下是配置文件 <bean id="authTokenAOPInterceptor" class="cn.test.inter.authTokenAOPInterceptor"/>
<aop:config proxy-target-class="true">
<aop:aspect ref="authTokenAOPInterceptor" order="1"> <aop:before method="before" pointcut-ref="authCheckPointcut"/> </aop:aspect></aop:config>authTokenAOPInterceptor类public class authTokenAOPInterceptor {
WeiXinService ser=new WeiXinService();
private static final String authFieldName = "authToken";
public void before(JoinPoint joinPoint, AuthToken authToken) throws Throwable{
Object[] args = joinPoint.getArgs(); //获取拦截方法的参数
错误原因
authTokenAOPInterceptor类中的before方法方法参数写的是authToken然鹅配置文件写的是
<aop:pointcut id="authCheckPointcut" expression="@annotation(AuthToken)"/>两者改成一致即可也就是 <aop:pointcut id="authCheckPointcut" expression="@annotation(authToken)"/>参考网址: https://stackoverflow.com/questions/8574348/error-type-referred-to-is-not-an-annotation-type
error Type referred to is not an annotation type: AuthToken
以下是配置文件 <bean id="authTokenAOPInterceptor" class="cn.test.inter.authTokenAOPInterceptor"/>
<aop:config proxy-target-class="true">
<aop:pointcut id="authCheckPointcut" expression="@annotation(AuthToken)"/>
<aop:aspect ref="authTokenAOPInterceptor" order="1"> <aop:before method="before" pointcut-ref="authCheckPointcut"/> </aop:aspect></aop:config>authTokenAOPInterceptor类public class authTokenAOPInterceptor {
WeiXinService ser=new WeiXinService();
private static final String authFieldName = "authToken";
public void before(JoinPoint joinPoint, AuthToken authToken) throws Throwable{
Object[] args = joinPoint.getArgs(); //获取拦截方法的参数
错误原因
authTokenAOPInterceptor类中的before方法方法参数写的是authToken然鹅配置文件写的是
<aop:pointcut id="authCheckPointcut" expression="@annotation(AuthToken)"/>两者改成一致即可也就是 <aop:pointcut id="authCheckPointcut" expression="@annotation(authToken)"/>参考网址: https://stackoverflow.com/questions/8574348/error-type-referred-to-is-not-an-annotation-type
相关文章推荐
- error Type referred to is not an annotation type: validate 0 formal unbound in pointcut
- 使用AOP处理注解时出现error Type referred to is not an annotation type:xxx
- Uncaught TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node 解决办法
- 解决办法:Access restriction: The type JPEGImageEncoder is not accessible due to restriction on required
- Android酱油笔记之关于AlertDialog的Unable to add window token null is not for an application解决办法
- python2.7web代码用python3.6运行时,浏览器发送请求报错TypeError: Object of type 'bytes' is not JSON serializable的解决办法
- 解决办法:Access restriction: The type JPEGImageEncoder is not accessible due to restriction
- The application is not licensed to modify or create schema for this type of data 解决办法
- 使用AlertDialog.Builder的时候出现错误:unable to add window --token null is not for an application的解决办法
- Python 出现错误TypeError: ‘NoneType’ object is not iterable解决办法
- mysql远程连接:ERROR 1130 (HY000): Host '*.*.*.*' is not allowed to connect to this MySQL server解决办法
- Type interface is not known to the MapperRegistry.的解决办法
- 解决办法:Access restriction: The type JPEGImageEncoder is not accessible due to restriction
- 解决办法:Access restriction: The type JPEGImageEncoder is not accessible due to restriction .
- Type interface com.mapper.GradeMapper is not known to the MapperRegistry的解决办法
- 解决办法:Access restriction: The type JPEGImageEncoder is not accessible due to restriction
- Error: JAVA_HOME is set to an invalid directory.解决办法
- android AlertDialog显示错误 Unable to add window token null is not for an application解决办法
- 解决办法:Access restriction: The type JPEGImageEncoder is not accessible due to restriction
- 解决办法:Access restriction: The type JPEGImageEncoder is not accessible due to restriction