首页 > 开发 > Java > 正文

运用Spring AOP验证用户权限实例

2024-07-14 08:44:00
字体:
来源:转载
供稿:网友
 1.新建一个Java普通工程,并需导入spring-aop.jar包;

  2.建UserInfo类:

  

      package aop.secure;

  public class UserInfo {

  private String userName;

  private String password;

  public UserInfo(String userName, String password){

  this.userName = userName;

  this.password = password;

  }

  public String getPassword() {

  return password;

  }

  public String getUserName() {

  return userName;

  }

  }

  3.建安全信息提示类SecureBean:

  

     package aop.secure;

  public class SecureBean {

  public void writeSecureMessage(){

  System.out.println("Every time I learn something new and it pushes some old stuff out of my brain.");

  }

  }

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表