写了一个service,使用了权限注解和springMVC的注解,结果无效:
@Service
public class ShiroService {@RequiresRoles({"admin"})public void testMethod(){System.out.println("testMethod,time:"+new Date());}
}
这样写的话, @RequiresRoles({"admin"})注解没有起作用。
将@Service去掉,改为在applicationContext.xml中配置:
这样就ok了。
ps:同时,也不要将事务的注解写在service上面,可以写在controller上面。