zoukankan      html  css  js  c++  java
  • (八)springmvc+mybatis+dubbo+zookeeper分布式架构 整合

    子项目的基础框架已经构建完成,今天重点讲解的是ant-framework核心代码的编写过程。

    其中ant-framework是ant分布式框架的基础核心框架,其中包括CRUD,MVC等一系列基类和模板。另外定义了spring,mybatis,wink等底层框架扩展项目,具体内容包括:

    1. annotation相关注解:数据签名注解、用户是否走sso登录注解等,今天我们着重讲解一下annotation的编写。

    提醒:自定义annotation可以有效的将我们需要注解的类、方法、字段根据业务所需进行定义可配置化。

    2. 编写数字签名的annotaion的类,DataSign.java内容如下:

        package com.sml.sz.common.annotation;  
          
        import java.lang.annotation.ElementType;  
        import java.lang.annotation.Retention;  
        import java.lang.annotation.RetentionPolicy;  
        import java.lang.annotation.Target;  
          
        /** 
         * 数据签名注解 
         */  
        @Target(ElementType.METHOD)    
        @Retention(RetentionPolicy.RUNTIME)    
        public @interface DataSign {  
        }  
    

      3. 编写sso单点登录认证的annotion类,IsLogin.java内容如下:

        package com.sml.sz.common.annotation;  
          
        import java.lang.annotation.ElementType;  
        import java.lang.annotation.Retention;  
        import java.lang.annotation.RetentionPolicy;  
        import java.lang.annotation.Target;  
          
        /** 
         * 登录注解 
         */  
        @Target(ElementType.METHOD)    
        @Retention(RetentionPolicy.RUNTIME)    
        public @interface IsLogin {  
          
        }  
    

      4. 编写Bean的中文注解:

        package com.sml.sz.common.annotation;  
          
        import java.lang.annotation.ElementType;  
        import java.lang.annotation.Retention;  
        import java.lang.annotation.RetentionPolicy;  
        import java.lang.annotation.Target;  
          
        /** 
         * bean中文名注解 
         */  
        @Target(ElementType.METHOD)    
        @Retention(RetentionPolicy.RUNTIME)    
        public @interface FieldName {  
            String value();  
        }  
    

      5.架构代码如下:

    文章内容不写太多,希望大家能够掌握每一个知识点,这里的注解后面会全部定义在方法上,具体的业务和实现后面会讲解到。

    资料和源码来源

  • 相关阅读:
    poj 3662 Telephone Lines
    费马小定理证明
    CodeForces 1058 F Putting Boxes Together 树状数组,带权中位数
    共价大爷游长沙 lct 维护子树信息
    牛客暑假多校 F RIKKA with Line Graph
    牛客暑假多校 H Prefix sum
    HDU-6437 Videos
    模板汇总——AC自动机
    模板汇总——逆元
    模板汇总——LCT
  • 原文地址:https://www.cnblogs.com/xiamudaren/p/8440740.html
Copyright © 2011-2022 走看看