我用的是springboot微框架。权限管控用的shiro,现在要使用aop,总是报以下错误:
Error creating bean with name 'shiroFilterFactoryBean' defined in class path resource [com/zcy/salesPlatform/shiro/ShiroConfig.class]: BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration': Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: Pointcut is not well-formed: expecting 'identifier' at character position 0
- com.zcy.salesPlatform.action.sell.order.*.*(..)
我的aop类:
package com.zcy.salesPlatform.aop;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;
@Aspect
@Component
public class LoggerAop {
@Pointcut("* com.zcy.salesPlatform.action.sell.order.*.*(..)")
public void loggerAspect(){}
@Before("loggerAspect()")
public void before() {
System.out.println("切面before执行了");
}
/*@After("loggerAspect()")
public void after() {
System.out.println("切面after执行了");
}
@AfterReturning("loggerAspect()")
public void afterReturning() {
System.out.println("切面afterReturning执行了");
}
@AfterThrowing("loggerAspect()")
public void afterThrowing() {
System.out.println("切面afterThrowing执行了");
}*/
/*@Around("loggerAspect()")
public Object around(ProceedingJoinPoint thisJoinPoint){
Object obj = null;
System.err.println ("切面around before执行了");
try {
thisJoinPoint.proceed();
} catch (Throwable e) {
e.printStackTrace ();
}
System.err.println ("切面around after执行了");
return obj;
}*/
}
我的shiro。config类:
package com.zcy.salesPlatform.shiro;
import java.util.LinkedHashMap;
import java.util.Map;
import org.apache.shiro.spring.LifecycleBeanPostProcessor;
import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* spring boot 集成shiro的配置 http://blog.csdn.net/catoop/article/details/50520958
*
* @author luanhaibin
*/
@Configuration
public class ShiroConfig {
private static Map<String, String> filterChainDefinitionMap = new LinkedHashMap<String, String>();
@Bean(name = "shiroFilterFactoryBean")
public ShiroFilterFactoryBean shiroFilterFactoryBean() {
ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();
shiroFilterFactoryBean.setSecurityManager(securityManager());
shiroFilterFactoryBean.setLoginUrl("/user/login");
shiroFilterFactoryBean.setSuccessUrl("/menu/menuIndex");
//
filterChainDefinitionMap.put("/menu/**", "authc");
// filterChainDefinitionMap.put("/personcenter/**", "authc");
filterChainDefinitionMap.put("/**", "anon");
//
shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap);
return shiroFilterFactoryBean;
}
@Bean(name = "securityManager")
public DefaultWebSecurityManager securityManager() {
DefaultWebSecurityManager defaultWebSecurityManager = new DefaultWebSecurityManager();
defaultWebSecurityManager.setRealm(shiroRealm());
return defaultWebSecurityManager;
}
@Bean(name = "shiroRealm")
public ShiroRealm shiroRealm() {
return new ShiroRealm();
}
@Bean(name = "lifecycleBeanPostProcessor")
public LifecycleBeanPostProcessor lifecycleBeanPostProcessor() {
// AbstractNativeSessionManager a=new AbstractNativeSessionManager();
return new LifecycleBeanPostProcessor();
}
}
请教各位老师各位大神,怎么破?