常用工具模板

JAVA 实现阿里云短信申请模板以及批量发送短信 使用java实现阿里云短信申请模板以及单次发送短信、批量发送短信、查询短信模板、删除短信模板等。 阅读详情


提示:以下是本篇文章正文内容,来源于黑马案例

一、短信模板(阿里)

1. maven坐标

	   <dependency>
            <groupId>com.aliyun</groupId>
            <artifactId>aliyun-java-sdk-core</artifactId>
            <version>4.5.3</version>
        </dependency>
        
        <dependency>
            <groupId>com.aliyun</groupId>
            <artifactId>dysmsapi20170525</artifactId>
            <version>2.0.1</version>
        </dependency>

2. application.yml

  #阿里短信
  sms:
    signName: 改成自己的
    templateCode: 改成自己的
    accessKey: 改成自己的
    secret: 改成自己的

3. SmsProperties

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

@Data
@ConfigurationProperties(prefix = "sms")
public class SmsProperties {
    private String signName;
    private String templateCode;
    private String accessKey;
    private String secret;
}

4. SmsTemplate

import com.aliyun.dysmsapi20170525.models.SendSmsRequest;
import com.aliyun.dysmsapi20170525.models.SendSmsResponse;
import com.aliyun.dysmsapi20170525.models.SendSmsResponseBody;
import com.aliyun.teaopenapi.models.Config;
import com.tanhua.autoconfig.properties.SmsProperties;

public class SmsTemplate {

    private SmsProperties properties;

    public SmsTemplate(SmsProperties properties) {
        this.properties = properties;
    }

    public void sendSms(String mobile,String code) {
        try {
            //配置阿里云
            Config config = new Config()
                    // 您的AccessKey ID
                    .setAccessKeyId(properties.getAccessKey())
                    // 您的AccessKey Secret
                    .setAccessKeySecret(properties.getSecret());
            // 访问的域名
            config.endpoint = "dysmsapi.aliyuncs.com";
            com.aliyun.dysmsapi20170525.Client client =  new com.aliyun.dysmsapi20170525.Client(config);

            SendSmsRequest sendSmsRequest = new SendSmsRequest()
                    .setPhoneNumbers(mobile)
                    .setSignName(properties.getSignName())
                    .setTemplateCode(properties.getTemplateCode())
                    .setTemplateParam("{\"code\":\""+code+"\"}");
            // 复制代码运行请自行打印 API 的返回值
            SendSmsResponse response = client.sendSms(sendSmsRequest);
            SendSmsResponseBody body = response.getBody();
            System.out.println(body.getMessage());

        }catch (Exception e) {
            e.printStackTrace();
        }
    }
}

5. AutoConfiguration

import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;

@EnableConfigurationProperties({
        SmsProperties.class
})
public class AutoConfiguration {

    //阿里云短信
    @Bean
    public SmsTemplate smsTemplate(SmsProperties properties) {
        return new SmsTemplate(properties);
    }
}

6. 测试

@RunWith(SpringRunner.class)
@SpringBootTest(classes = AppServerApplication.class)
public class SmsTemplateTest {

    //注入
    @Autowired
    private SmsTemplate smsTemplate;

    //测试
    @Test
    public void testSendSms() {
        smsTemplate.sendSms("1845645592","4567");
    }
}

二、人脸识别(百度)

1. maven坐标

  		<!--百度人脸识别API-->
        <dependency>
            <groupId>com.baidu.aip</groupId>
            <artifactId>java-sdk</artifactId>
            <version>4.8.0</version>
        </dependency>

2. application.yml

  #百度人脸别
  aip:
    appId: 改成你自己的
    apiKey: 改成你自己的
    secretKey: 改成你自己的

3. AipFaceProperties

import com.baidu.aip.face.AipFace;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;

@Data
@ConfigurationProperties(prefix = "aip")
public class AipFaceProperties {
    private String appId;
    private String apiKey;
    private String secretKey;

    @Bean
    public AipFace aipFace() {
        AipFace client = new AipFace(appId, apiKey, secretKey);
        // 可选:设置网络连接参数
        client.setConnectionTimeoutInMillis(2000);
        client.setSocketTimeoutInMillis(60000);
        return client;
    }
}

4. AipFaceTemplate

import com.baidu.aip.face.AipFace;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.HashMap;

public class AipFaceTemplate {

    @Autowired
    private AipFace client;

    /**
     * 检测图片中是否包含人脸
     *  true:包含
     *  false:不包含
     */
    public boolean detect(String imageUrl) {
        // 调用接口
        String imageType = "URL";
        HashMap<String, String> options = new HashMap<String, String>();
        options.put("face_field", "age");
        options.put("max_face_num", "2");
        options.put("face_type", "LIVE");
        options.put("liveness_control", "LOW");

        // 人脸检测
        JSONObject res = client.detect(imageUrl, imageType, options);
        System.out.println(res.toString(2));
        Integer error_code = (Integer) res.get("error_code");

        return error_code == 0;
    }
}

5. AutoConfiguration

import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;

@EnableConfigurationProperties({
        AipFaceProperties.class
})
public class TanhuaAutoConfiguration {
    //百度人脸识别
    @Bean
    public AipFaceTemplate aipFaceTemplate() {
        return new AipFaceTemplate();
    }
}

6. 测试

@RunWith(SpringRunner.class)
@SpringBootTest(classes = AppServerApplication.class)
public class FaceTest {
    @Autowired
    AipFaceTemplate aipFaceTemplate;

    @Test
    public void aipFaceTemplateTest(){
        boolean detect = aipFaceTemplate.detect("https://tanhua001.oss-cn-beijing.aliyuncs.com/2021/04/19/a3824a45-70e3-4655-8106-a1e1be009a5e.jpg");
        System.out.println(detect);
    }

}

在这里插入图片描述

三、即时通讯(环信)

1. maven坐标

		<!--环信即时通讯-->
        <dependency>
            <groupId>com.easemob.im</groupId>
            <artifactId>im-sdk-core</artifactId>
            <version>0.2.5</version>
        </dependency>

2. application.yml

  #环信即时通信
  huanxin:
    appkey: 改成自己的
    clientId: 改成自己的
    clientSecret: 改成自己的

3. HuanXinProperties

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

@Data
@ConfigurationProperties(prefix = "huanxin")
public class HuanXinProperties {
    private String  appkey;
    private String  clientId;
    private String  clientSecret;

}

4. HunaXinTemplate

import cn.hutool.core.collection.CollUtil;
import com.easemob.im.server.EMProperties;
import com.easemob.im.server.EMService;
import com.easemob.im.server.model.EMTextMessage;
import lombok.extern.slf4j.Slf4j;

import java.util.Set;

public class HunaXinTemplate {
    private EMService emService;

    public HunaXinTemplate(HuanXinProperties huanXinProperties) {
        EMProperties properties = EMProperties.builder()
                .setAppkey(huanXinProperties.getAppkey())
                .setClientId(huanXinProperties.getClientId())
                .setClientSecret(huanXinProperties.getClientSecret())
                .build();

        emService = new EMService(properties);
    }

    /**
     * 创建环信用户
     *
     * @param username
     * @param password
     * @return
     */
    public Boolean createUser(String username, String password) {
        try {
            //创建环信用户
            emService.user().create(username.toLowerCase(), password)
                    .block(); // .block()如果不需要等待响应,不需要阻塞  则使用.block()
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            log.error("创建环信用户失败~");
        }
        return false;
    }

    /**
     * 添加联系人
     *
     * @param username1
     * @param username2
     * @return
     */
    public Boolean addContact(String username1, String username2) {
        try {
            //创建环信用户
            emService.contact().add(username1, username2)
                    .block();
            return true;
        } catch (Exception e) {
            log.error("添加联系人失败~");
        }
        return false;
    }

    /**
     * 删除联系人
     *
     * @param username1
     * @param username2
     * @return
     */
    public Boolean deleteContact(String username1, String username2) {
        try {
            //删除环信用户
            emService.contact().remove(username1, username2)
                    .block();
            return true;
        } catch (Exception e) {
            log.error("删除联系人失败~");
        }
        return false;
    }

    /**
     * 发送消息
     *
     * @param username
     * @param content
     * @return
     */
    public Boolean sendMsg(String username, String content) {
        try {
            //接收人用户列表
            Set<String> set = CollUtil.newHashSet(username);
            //文本消息
            EMTextMessage message = new EMTextMessage().text(content);
            //发送消息  from:admin是管理员发送
            emService.message().send("admin", "users",
                    set, message, null).block();
            return true;
        } catch (Exception e) {
            log.error("删除联系人失败~");
        }
        return false;
    }
}

5. AutoConfiguration

import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;

@EnableConfigurationProperties({
        HuanXinProperties.class
})
public class AutoConfiguration {
    //环信即时通讯
    @Bean
    public HunaXinTemplate hunaXinTemplate(HuanXinProperties huanXinProperties) {
        return new HunaXinTemplate(huanXinProperties);
    }

}

6. 测试

@RunWith(SpringRunner.class)
@SpringBootTest(classes = AppServerApplication.class)
public class HuanXinTest {
    @Autowired
    private HunaXinTemplate hunaXinTemplate;

    /**
     * 保存用户
     */
    @Test
    public void saveUser() {
        Boolean b = hunaXinTemplate.createUser("hx1", "123456");
         hunaXinTemplate.createUser("hx106", "123456");
        System.out.println(b);
    }

    /**
     * 添加联系人
     */
    @Test
    public void addContact() {
        Boolean aBoolean = hunaXinTemplate.addContact("hx1", "hx106");
        System.out.println(aBoolean);
    }

    /**
     * 删除联系人
     */
    @Test
    public void delContact() {
        Boolean aBoolean = hunaXinTemplate.deleteContact("hx1", "hx106");
        System.out.println(aBoolean);
    }


    /**
     * 发消息
     */
    @Test
    public void sendMsg() {
        Map<String, Object> msgMap = new HashMap<>();
        msgMap.put("name", "沧海");
        msgMap.put("age", 18);
        String message = JSON.toJSONString(msgMap);
        Boolean msgB = hunaXinTemplate.sendMsg("hx1", message);
        System.out.println(msgB);
    }
}

四、文件上传

application.yml

spring:
  servlet:
    multipart:
      max-file-size: 30MB
      max-request-size: 30MB

1. 方法1

1. controller

@PostMapping("/fileUpLoad")
    public Result fileUpLoad(MultipartFile imageContent[]) {
        userService.fileUpLoad(imageContent);
        return Result .ok(""); //正常返回状态码200
    }

2. service

@Override
public void fileUpLoad(MultipartFile[] imageContent) {
        //将图片上传
        int length = imageContent.length;
        if (length > 0) {
            for (MultipartFile file : imageContent) {
                //将用户头像上传到服务器
                String filename = file.getOriginalFilename();
//                String prefix = filename.substring(0, filename.lastIndexOf("."));
                String prefix = "D:\\images\\";
//                String suffix = filename.substring(filename.lastIndexOf(".") + 1);
                try {
//                    File f = File.createTempFile("YY" + prefix, suffix + ".");
                    //上传
                    file.transferTo(new File(prefix + filename));
                    //将临时文件删除
//                    f.delete();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
       

2. 方法2

@PostMapping("/fileUpLoad")
public void fileupLoad(HttpServletRequest request) {
        //获取运行环境
        String osName = System.getProperties().getProperty("os.name").toLowerCase();
        boolean isLinux = "linux".equals(osName);
        //将上下文初始化给多部份解析器
        CommonsMultipartResolver multipartResolver = new CommonsMultipartResolver(request.getSession().getServletContext());
        //检查form中是否有(multipart/form-data)
        if (multipartResolver.isMultipart(request)) {
            //将Request变成多部份Request
            MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;

            //获取所有文件名
            Iterator<String> iter = multipartRequest.getFileNames();
            while (iter.hasNext()) {
                MultiValueMap<String, MultipartFile> multiFileMap = multipartRequest.getMultiFileMap();
                List<MultipartFile> multipartFileList = multiFileMap.get(iter.next().toString());
                for (MultipartFile multipartFile : multipartFileList) {
                    try {
                        if (null != multipartFile) {
                            String originalFilename = multipartFile.getOriginalFilename();
                            String fileName = originalFilename.substring(originalFilename.lastIndexOf("/") + 1);
                            if (isLinux) {
                                //linux环境  进行SFTP上传
                            } else {
//                                String prefix = originalFilename.substring(0, originalFilename.lastIndexOf("."));
                                String prefix = "D:\\images\\";
//                                String suffix = originalFilename.substring(originalFilename.lastIndexOf("."));

                                //创建临时文件
//                                File file = File.createTempFile("YY" + prefix, "." + suffix);
                                //上传
                                multipartFile.transferTo(new File(prefix + fileName));
                                //将临时文件删除
//                                file.delete();
                            }
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            }
        }
    }

五、FastDFS(文件系统)

使用docker安装FastDFS及简单的使用

1. maven坐标

	<!--fastdfs文件存储-->
        <dependency>
            <groupId>com.github.tobato</groupId>
            <artifactId>fastdfs-client</artifactId>
            <version>1.26.7</version>
            <exclusions>
                <exclusion>
                    <groupId>ch.qos.logback</groupId>
                    <artifactId>logback-classic</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

2. application.yml

fdfs:
  so-timeout: 1500 #读取超时时间
  connect-timeout: 600 #连接超时时间
  thumb-image: #缩略图参数
    width: 150
    height: 150
  tracker-list: 192.0.0.166:22122 #tracker服务器地址 可配置多个
  web-server-url: http://192.0.0.166:8888 #访问路径 storage中nginx地址

3. 测试

@RunWith(SpringRunner.class)
@SpringBootTest(classes = AppServerApplication.class)
public class FastDFSTest {
    @Autowired
    protected FastFileStorageClient storageClient;
    @Autowired
    private FdfsWebServer fdfsWebServer;

    @Test
    public void testUpload() {
        String path = "E:\\Download\\GoogleDownload\\123.jpg";
        File file = new File(path);
        try {
            //上传图片
            StorePath storePath = this.storageClient.uploadFile(FileUtils.openInputStream(file), file.length(), "jpg", null);
            //拼接路径   可通过该路径访问上传的照片  http://192.0.0.166:8888/group1/M00/00/00/wKiIoGMB7PmAUPZZAAHMYGEwMhg147.jpg
            String url = fdfsWebServer.getWebServerUrl() + "/" + storePath.getFullPath();
            System.out.println(url);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

六、地理位置搜索附近(MONGO)

docker安装mongoDB及使用
百度拾取坐标

了解:
地理位置查询,必须创建索引才可以能查询
地理位置查询,必须创建索引才可以能查询
地理位置查询,必须创建索引才可以能查询
目前有两种索引:

2d :
使用2d index 能够将数据作为二维平面上的点存储起来,在MongoDB 2.4以前使用2。

2dsphere(使用的多):
2dsphere索引支持查询在一个类地球的球面上进行几何计算,以GeoJSON对象或者普通坐标对的方式存储数据。

MongoDB内部支持多种GeoJson对象类型:

Point
{ type: “Point”, coordinates: [ 40, 5 ] }
LineString
{ type: “LineString”, coordinates: [ [ 40, 5 ], [ 41, 6 ] ] }
Polygon
{
type: “Polygon”,
coordinates: [ [ [ 0 , 0 ] , [ 3 , 6 ] , [ 6 , 1 ] , [ 0 , 0 ] ] ]
}

1. maven坐标

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-mongodb</artifactId>
             <version>2.3.9.RELEASE</version>
        </dependency>

2. application.yml

spring:
  data:
    mongodb:
      uri: mongodb://192.156.136.168:27017/testdb
      username: root
      password: 123456

3. 实体类

@Data
@NoArgsConstructor
@AllArgsConstructor
@Document(collection = " geographical_location")
//地理位置查询,必须创建索引才可以能查询  为location字段建立2dsphere索引  索引名为location_index
@CompoundIndex(name = "location_index", def = "{'location': '2dsphere'}")
public class GeographicalLocation implements java.io.Serializable{
    @Id
    private ObjectId id;
    @Indexed
    private Long userId; //用户id
    private GeoJsonPoint location; //x:经度 y:纬度
    private String address; //位置描述
    private Long created; //创建时间
    private Long updated; //更新时间
    private Long lastUpdated; //上次更新时间
}

4.测试

@RunWith(SpringRunner.class)
@SpringBootTest(classes = MongoApplication.class)
public class MongoTest {
    @Autowired
    private MongoTemplate mongoTemplate;

    /**
     * 查询附近
     */
    @Test
    public void testNear() {
        //构造坐标点
        GeoJsonPoint point = new GeoJsonPoint(116.404, 39.915);
        //构造半径  1:半径长度  Metrics.KILOMETERS:单位 km
        Distance distanceObj = new Distance(1, Metrics.KILOMETERS);
        //画了一个圆圈
        Circle circle = new Circle(point, distanceObj);
        //构造query对象
        Query query = Query.query(Criteria.where("location").withinSphere(circle));
        //省略其他内容
        List<GeographicalLocation> list = mongoTemplate.find(query, GeographicalLocation.class);
        list.forEach(System.out::println);
    }

    /**
     * 查询附近且获取间距
     */
    @Test
    public void testNear1() {
        //1、构造中心点(圆点)
        GeoJsonPoint point = new GeoJsonPoint(116.404, 39.915);
        //2、构建NearQuery对象
        NearQuery query = NearQuery.near(point, Metrics.KILOMETERS).maxDistance(1, Metrics.KILOMETERS);
        //3、调用mongoTemplate的geoNear方法查询
        GeoResults<GeographicalLocation> results = mongoTemplate.geoNear(query, GeographicalLocation.class);
        //4、解析GeoResult对象,获取距离和数据
        for (GeoResult<GeographicalLocation> result : results) {
            GeographicalLocation places = result.getContent();
            double value = result.getDistance().getValue();
            System.out.println(places + "---距离:" + value + "km");
        }
    }

}

七、全局异常处理

全局异常处理

1. 响应状态码

public enum ResponseStatusCode {
    SUCCESS_CODE(200, "执行成功"),
    FAIL_CODE(201, "执行失败"),

    CHECK_CODE_ERROR(2001, "验证码对比错误"),
    PHONE_ERROR(2002, "手机号对比错误"),
    CONTEXT_EMPTY(2003, "内容不允许为空"),


    ;

    private Integer code;
    private String msg;

    public Integer getCode() {
        return code;
    }


    public String getMsg() {
        return msg;
    }

    ResponseStatusCode(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }
}

2. 自定义异常

public class CustomException extends RuntimeException {

    private Integer code;
    private String message;


    public CustomException(Integer code, String message) {
        super(message);
        this.message = message;
        this.code = code;
    }


    public CustomException( String message) {
        super(message);
        this.message = message;
    }


    @Override
    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }
}

3. 全局异常处理

@ControllerAdvice //只要是添加了@Controller的类,产生的异常都会在这边处理
@ResponseBody
public class GlobalExceptionHandler {
    /**
     * 处理自定义异常
     *
     * @param c
     * @return
     */
    @ExceptionHandler(value = CustomException.class)
    public ResponseEntity customException(CustomException c) {
        c.printStackTrace();
        return ResponseEntity.status(c.getCode()).body(c.getMessage());
    }

    @ExceptionHandler(value = Exception.class)
    public ResponseEntity error(Exception e) {
        e.printStackTrace();
        return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(e.getMessage());
    }
}

4. 测试

public void exceptionTest(String context){
        if(StringUtils.isEmpty(context)){
            throw new CustomException(ResponseStatusCode.CONTEXT_EMPTY.getCode(),ResponseStatusCode.CONTEXT_EMPTY.getMsg());
        }
        System.out.println(true);
    }

八、自定义响应结果类

/**
 * 响应状态码
 */
public enum ResponseStatusCode {
    SUCCESS_CODE(200, "执行成功"),
    FAIL_CODE(201, "执行失败"),


    ;

    private Integer code;
    private String msg;

    public Integer getCode() {
        return code;
    }


    public String getMsg() {
        return msg;
    }

    ResponseStatusCode(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    /**
     * 根据状态码获取信息
     *
     * @param code
     * @return
     */
    public static String getMsgByCode(Integer code) {
        for (ResponseStatusCode response : ResponseStatusCode.values()) {
            if(code == response.getCode()){
                return response.getMsg();
            }
        }
        return "未知消息";
    }

}

import java.io.Serializable;

/**
 * 自定义响应结果集
 */
public class Result implements Serializable {


    /**
     * 成功--不携带数据
     *
     * @return
     */
    public static Result success() {
        return new Result(ResponseStatusCode.SUCCESS_CODE.getCode(), ResponseStatusCode.SUCCESS_CODE.getMsg());
    }

    /**
     * 成功--携带数据
     *
     * @param data
     * @return
     */
    public static Result success(Object data) {
        return new Result(ResponseStatusCode.SUCCESS_CODE.getCode(), ResponseStatusCode.SUCCESS_CODE.getMsg(), data);
    }

    /**
     * 失败  -- 根据状态码返回错误信息
     *
     * @param code
     * @return
     */
    public static Result fail(Integer code) {
        return new Result(code, ResponseStatusCode.getMsgByCode(code));
    }

    /**
     * 失败-- 固定状态码  自定义返回信息
     *
     * @param msg
     * @return
     */
    public static Result fail(String msg) {
        return new Result(ResponseStatusCode.FAIL_CODE.getCode(), msg);
    }



    private Integer code;  //状态码
    private String msg;  //消息
    private Object data; //数据

    public Result() {
    }

    public Result(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Result(Integer code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}

九、mybatis-plus分页配置

mybatis-plus分页配置

十、对数组进行分页

    @Test
    public void pageTest() {
        int page = 1, pagesize = 3;
        String str = "1,2,3,4,5,6,7,8";
        String[] array = str.split(",");
        /**
         * 对数组进行分页
         */
        if ((page - 1) * pagesize < array.length) {
            List<Long> pidList = Arrays.stream(array).skip((page - 1) * pagesize).limit(pagesize)
                    .map(item -> Convert.toLong(item)).collect(Collectors.toList());
            
            System.out.println(pidList.toString());
        }
        //获取总页数
         int totalPage= PageUtil.totalPage(array .length,pagesize);
         System.out.println(totalPage);
    }

十一、搭建网关(gateway)

  1. maven坐标
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-gateway</artifactId>
        </dependency>
        <dependency>
            <groupId>com.alibaba.cloud</groupId>
            <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
        </dependency>
        <!-- 监控检查-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>com.itheima</groupId>
            <artifactId>tanhua-commons</artifactId>
            <version>1.0-SNAPSHOT</version>
        </dependency>
  1. application.yml
server:
  port: 8888
spring:
  profiles:
    active: prod
  application:
    name: tanhua-gateway
  cloud:
    nacos:
      discovery:
        server-addr: 192.168.136.160:8848
    gateway:
      #支持跨域
      globalcors:
        add-to-simple-url-handler-mapping: true
        corsConfigurations:
          '[/**]':
            allowedHeaders: "*"
            allowedOrigins: "*"
            allowedMethods:
              - GET
              - POST
              - DELETE
              - PUT
              - OPTION
      #路由
      routes:
        # 前台系统
        - id: tanhua-app-server
          #转到tanhua-app-server系统, 在nacos服务列表中copy服务名称   要与服务名称一致
          uri: lb://tanhua-app-server
          #当请求以app开头时 会将请求转到tanhua-app-server系统
          predicates:
            - Path=/app/**
          #过滤掉前缀app  因为controller中并没有app
          filters:
            - StripPrefix= 1
        # 后台系统
        - id: tanhua-admin
          uri: lb://tanhua-admin
          predicates:
            - Path=/admin/**
          filters:
            - StripPrefix= 1
#自定义配置   excludedUrls中的请求不用鉴权
gateway:
  # 当以,分割时,会自动解析为数组
  excludedUrls: /user/login,/user/loginVerification,/system/users/verification,/system/users/login
  1. 配置鉴权管理器
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.tanhua.commons.utils.JwtUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.cloud.gateway.filter.GlobalFilter;
import org.springframework.core.Ordered;
import org.springframework.core.io.buffer.DataBuffer;
import org.springframework.http.HttpStatus;
import org.springframework.http.server.reactive.ServerHttpResponse;
import org.springframework.stereotype.Component;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Component
public class AuthFilter implements GlobalFilter, Ordered {

    //排除的链接  解析为数组
    @Value("${gateway.excludedUrls}")
    private List<String> excludedUrls;

    @Override
    public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
        String url = exchange.getRequest().getURI().getPath();

        System.out.println( "url:"+ url);
        //排除特殊接口 不校验
        if(excludedUrls.contains(url)){
            return chain.filter(exchange);
        }
        String token = exchange.getRequest().getHeaders().getFirst("Authorization");
        if(!StringUtils.isEmpty(token)){
            token = token.replace("Bearer ", "");
        }
        ServerHttpResponse response = exchange.getResponse();

        //2、使用工具类,判断token是否有效
        boolean verifyToken = JwtUtils.verifyToken(token);
        //3、如果token失效,返回状态码401,拦截
        if(!verifyToken) {
            Map<String, Object> responseData = new HashMap<>();
            responseData.put("errCode", 401);
            responseData.put("errMessage", "用户未登录");
            return responseError(response,responseData);
        }
        return chain.filter(exchange);
    }

    //响应错误数据
    private Mono<Void> responseError(ServerHttpResponse response,Map<String, Object> responseData){
        // 将信息转换为 JSON
        ObjectMapper objectMapper = new ObjectMapper();
        byte[] data = new byte[0];
        try {
            data = objectMapper.writeValueAsBytes(responseData);
        } catch (JsonProcessingException e) {
            e.printStackTrace();
        }
        // 输出错误信息到页面
        DataBuffer buffer = response.bufferFactory().wrap(data);
        response.setStatusCode(HttpStatus.UNAUTHORIZED);
        response.getHeaders().add("Content-Type", "application/json;charset=UTF-8");
        return response.writeWith(Mono.just(buffer));
    }

    /**
     * 设置过滤器的执行顺序
     */
    @Override
    public int getOrder() {
        return Ordered.LOWEST_PRECEDENCE;
    }
}
  1. 解决跨域
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.reactive.CorsWebFilter;
import org.springframework.web.cors.reactive.UrlBasedCorsConfigurationSource;
import org.springframework.web.util.pattern.PathPatternParser;
/**
 * 跨域支持
 */
@Configuration
public class CorsConfig {

    @Bean
    public CorsWebFilter corsFilter() {
        CorsConfiguration config = new CorsConfiguration();
        config.addAllowedMethod("*");
        config.addAllowedOrigin("*");
        config.addAllowedHeader("*");
        UrlBasedCorsConfigurationSource source =
                new UrlBasedCorsConfigurationSource(new PathPatternParser());
        source.registerCorsConfiguration("/**", config);
        return new CorsWebFilter(source);
    }
}
  1. 启动类
@SpringBootApplication
public class GatewayApplication {
    public static void main(String[] args) {
        SpringApplication.run(GatewayApplication.class, args);
    }
}

十二、Nacos配置中心集中管理配置文件

  1. maven坐标
        <!-- nacos配置中心依赖支持 -->
        <dependency>
            <groupId>com.alibaba.cloud</groupId>
            <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
        </dependency>
        
        <!-- Spring Boot 2.4版本开始,需要加入下面的配置,不然读取不到nacos 配置 -->
		<dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-bootstrap</artifactId>
            <version>3.0.3</version>
        </dependency>

  1. bootstrap.yml 配置
spring:
  profiles:
    # dev:开发环境 test:测试环境  prod: 生产环境
    active: dev
  application:
    name: gateway-server
  cloud:
    nacos:
      discovery:
        server-addr: XXX.XXX.XXX.XXX:8848
      config:
        server-addr: XXX.XXX.XXX.XXX:8848
        file-extension: yml
  1. Nacos配置文件
    在这里插入图片描述

十三、Spring重试功能

  1. maven坐标
<!--Spring重试模块-->
<dependency>
    <groupId>org.springframework.retry</groupId>
    <artifactId>spring-retry</artifactId>
</dependency>
<dependency>
    <groupId>org.aspectj</groupId>
    <artifactId>aspectjweaver</artifactId>
</dependency>
  1. 启动类中添加@EnableRetry注解来激活重试功能
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.retry.annotation.EnableRetry;

@SpringBootApplication
@EnableRetry //开启重试
public class Application {
    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
}
  1. 在需要支持重试操作的Service方法中添加@Retryable注解
import cn.hutool.core.util.RandomUtil;
import org.springframework.retry.annotation.Backoff;
import org.springframework.retry.annotation.Recover;
import org.springframework.retry.annotation.Retryable;
import org.springframework.stereotype.Service;

@Service
public class RetryService {
	/**
	 * @Retryable参数说明:
	 *		value:抛出指定异常才会重试
	 *		maxAttempts:最大重试次数,默认3次
	 *		backoff:重试等待策略,默认使用@Backoff
	 *		@Backoff 的value默认为1000L,我们设置为2000L;
	 *		multiplier(指定延迟倍数)默认为0,表示固定暂停1秒后进行重试,如果把multiplier设置为2,
	 *		                                  则第一次重试为2秒,第二次为4秒,第三次为6秒。
	**/

    @Retryable(value = RuntimeException.class, maxAttempts = 3, backoff = @Backoff(delay = 2000L, multiplier = 2))
    public int execute(int max) {
        int data = RandomUtil.randomInt(1, 99);
        System.out.println("生成:" + data);
        if (data < max) {
            throw new RuntimeException();
        }
        return data;
    }

	/**
	 * @Recover标注的方法,是在所有的重试都失败的情况下,最后执行该方法,该方法有2个要求
	 *	1. 方法的第一个参数必须是 Throwable 类型,最好与 @Retryable 中的 value一致
	 *	2. 方法的返回值必须与@Retryable的方法返回值一致,否则该方法不能被执行。
	**/
    @Recover //全部重试失败后执行
    public int recover(Exception e) {
        System.out.println("全部重试完成。。。。。");
        return 88; //返回默认
    }
}

十四、使用JDK1.8 Stream流生成树结构数据

实例类

import java.util.List;

public class TreeVo {
    private Integer id; //id
    private Integer pId; //父id
   private String name; //  名称
    private List<TreeVo> children;//子集目录

    public TreeVo(Integer id, Integer pId, String name) {
        this.id = id;
        this.pId = pId;
        this.name = name;
    }
    public TreeVo() {
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getpId() {
        return pId;
    }

    public void setpId(Integer pId) {
        this.pId = pId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<TreeVo> getChildren() {
        return children;
    }

    public void setChildren(List<TreeVo> children) {
        this.children = children;
    }

    @Override
    public String toString() {
        return "TreeVo{" +
                "id=" + id +
                ", pId=" + pId +
                ", name='" + name + '\'' +
                ", children=" + children +
                '}';
    }
}

测试类

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

public class TreeTest {
    public static void main(String[] args) {
        TreeVo s1 = new TreeVo(1, 0, "山东");
        TreeVo s2 = new TreeVo(2, 0, "北京");
        TreeVo s3 = new TreeVo(3, 1, "山东_1");
        TreeVo s4 = new TreeVo(4, 1, "山东_2");
        TreeVo s5 = new TreeVo(5, 2, "北京_1");
        TreeVo s6 = new TreeVo(6, 2, "北京_2");
        List<TreeVo> voList = new ArrayList<>();
        voList.add(s1);
        voList.add(s2);
        voList.add(s3);
        voList.add(s4);
        voList.add(s5);
        voList.add(s6);

        //根据父Id 对所有数据进行分组
        Map<Integer, List<TreeVo>> listMap = voList.parallelStream().collect(Collectors.groupingBy(TreeVo::getpId));
        //设置父Id下面的所有子数据List集合
        voList.forEach(val -> val.setChildren(listMap.get(val.getId())));
        //过滤出符合顶层父Id的所有数据,即所有数据都归属于一个顶层父Id
        List<TreeVo> returnList = voList.stream().filter(val -> 0 == val.getpId()).collect(Collectors.toList());
        System.out.println(returnList.toString());
    }
}
Springboot整合阿里云短信服务 点击AccessKey管理,开通使用子用户AccessKey 阅读详情

相关推荐

HALCON丨HDevelop常用工具之模板匹配----基于形状、基于描述、基于互相关、可变形

在工业应用中,定位是大多数应用场景必不可少的环节。通过定位,我们可以对设备作业位置或区域进行调整,如打标、切割、机械手引导等应用。除此之外,我们还可以对被测物进行定位,根据定位数据缩小检测区域以达到提高检测速度和降低误检的目的。我们一般采用模板匹配的方式对被测物进行定位。HALCON为我们提供了基于形状、基于互相关、基于描述符以及可变形的模板匹配。 以基于形状的模板匹配为例,为大家介绍如何通过H...

大胡子大叔的专栏 1万+

阿里云短信服务---测试模板实现

但你手机上接收到的是模板字符串,具体验证码可以自行存到Redis或者输出到控制台。这样你的手机就能接收到短信了~~~~~~~2023年阿里云短信服务。已经申请不到了,现在使用。依次点击下面图片的提示。

qlyyyi的博客 1977

4 海康视觉平台VisionMaster 上手系列:常用工具(一)

快速入门 工业机器视觉 机器视觉

HuangGong2022的博客 2万+

阿里云短信简介和接入流程

如果选择的是该选项,我们创建的是阿里云账号的AccessKey,是具有账户的完全权限,有了这个AccessKey以后,我们就可以通过API调用阿里云的服务,不仅是短信服务,其他服务(OSS,语音服务,内容安全服务,视频点播服务…经过上述的权限配置之后,那么新创建的这个 reggie 用户,仅有短信服务操作的权限,不具备别的权限,即使当前的AccessKey泄漏了,也只会影响短信服务,其他服务是不受影响的。根据官方文档的提示,引入对应的依赖,然后再引入对应的java代码,就可以发送消息了。

weixin_45734189的博客 3790

Java 领域中 Eclipse 的代码生成模板使用

本文旨在全面介绍Eclipse IDE中代码生成模板的使用方法,帮助Java开发者提高编码效率。内容涵盖基础模板使用、自定义模板创建、模板变量应用以及高级技巧。文章首先介绍基本概念,然后深入讲解模板创建和使用方法,接着通过实际案例展示应用场景,最后讨论高级技巧和最佳实践。代码模板(Code Template): 预定义的代码片段,可通过快捷键或上下文菜单快速插入代码生成(Code Generation): 自动创建代码的过程,通常基于模板和上下文信息变量(Variable)

Java大师兄的博客 360

NVIDIA DRIVE SDK学习(二)——NvMedia

可以通过使用NvSciBuf API通过NvMedia Tensor属性分配NvSciBuf来创建NvMedia张量。由于NvSciBuf API有助于NvMedia和NVIDIA®CUDA®之间的数据共享,这使得分配的张量可以在NvSciBuf API允许的情况下重复使用。它支持图像聚合操作。NvSciSync组件使得NvMedia组件可以与其他组件保持同步,比如CUDA组件、基于NvSciSync的组件等。立体视差模式:在这种模式下,该模块通过左图像和右图像来产生立体视差,从而进行物体深度测量。

weixin_39592381的博客 3052

阿里短信模板API

阿里短信模板调用的总结 进公司写后台管理端,需要调用阿里的短信模板接口,申请短信模板,供之后的APP端使用,对此进行简单的总结。 概述 短信模版,即具体发送的短信内容,可以支持验证码、短信通知、推广短信三种模式。验证码和短信通知,通过变量替换实现个性短信定制。 这是阿里官方文档的概述,简单来说就是:平常我们收到各大平台发送的短信,基本都是有固定的模板,然后类似于验证码或者个人信息等内容只需要调用模板然后替换即可; 示例 (1)验证码短信 【阿里云】您正在申请手机注册,验证码为:\${code

Maybe221的博客 1307

MPN – 制造商物料编号(延伸)

此外,用户还可以在物料主数据中定义阻止MPN材料的原因,以及在采购订单创建时,是否可以将现有的MPN材料修改为其他MPN材料,从而实现对MPN材料的精细控制和管理。通过使用AMPL,用户可以指定每个MPN材料是否仅能为特定工厂或整个企业所有工厂采购、采购的时间段、是否必须属于特定修订级别、是否只能从特定制造商工厂采购以及是否被阻止及其原因。通过AMPL管理,企业可以规范采购流程,避免使用未经批准的材料,从而提高采购的透明度和效率,同时也为质量控制提供了保障‌。3、QM中的制造商物料。质量信息记录QI01。

yanzibing99的博客 2496

最新版IDEA配置常用工具模板

最新版IDEA配置常用工具模板 文章目录前言mysql.propertiesoracle.propertieslog4j.propertiesMybatis Config.xmlMybatisUtil.java文末提供一波常用Maven依赖 前言 在使用 InelliJ IDEA 的过程中,如果能熟练的配置常用模块应用于实际开发过程中,效率将大大提高!!! Try it ! 提示:以下是本篇文章正文内容 第一步:File —>Settings 第二步: mysql.properties 注:

猫头虎技术团队:授渔优于赠鱼,兴趣引领智慧,探索之乐尤显珍贵。商务合作+:Libin9iOak ,万粉变现+:CSDNWF,猫头虎承诺每年免费为100名C站创作者做账号流量诊断服务!全网搜:猫头虎技术团队,点击文章底部名片或直接私信我一切皆可谈,快找虎哥! 938

南京银行信息技术岗提前批笔试与面试

1、笔试 笔试大致可以分为三部分:性格测试、行测题目、专业知识 性格测试 性格测试一般会有较多的体量,可能一共大概有一百多道接近两百道的样子,这个是不限时的。 前面有100道是这样的题目,就是有四个选项都是各种形容词,然后分别选出最符合自己的与最不符合自己的选项。这种题你就顺着自己的潜意识填就行了,但是前后要一致,我怀疑他出这么多题,可能就是考一考你记不记得前面填了啥。比如你做到第90题的时候,可能会出现和前面第2题类似的四个形容词,更有甚者就是一模一样的,你要对自己之前选的什么有个比较清楚的记忆。

qq_40971025的博客 6931

TensorFlow GPU版本安装步骤-Windows系统

本文由在Windows下安装TensorFlow GPU版本教程-CSDN等整理得到。 目录 1、确认显卡是否支持CUDA 1.1 查看显卡信息 打开“设备管理器”,查看显卡信息,如下图所示: 由上图知,本电脑的显卡为NVIDIA Quadro P400. 1.2 查看支持CUDA的显卡 网址:https://developer.nvidia.com/cuda-gpus 经查询可知,该显卡支持CUDA,如下图所示: 2、安装CUDA 2.1 下载CUDA 网址:https://developer.nvi

x_lingyun的专栏 771

HDevelop常用工具之模板匹配

▎基于形状的模板匹配 在开始之前先让我们了解一下什么是基于形状的模板匹配。形状是事物或物质的一种存在或表现形式,如长方形、正方形等。在图像中,形状是一种对边缘或区域的描述方式。HALCON基于形状的匹配是一种通过图像边缘进行被测物识别和定位的模式识别算法。该算法对光照的变化有很好的鲁棒性且处理速度快,是工业视觉解决方案中常用的定位手段。 本次使用的图像位于“%HALCONIMAGES%\...

qq_41072190的博客 1369

YOLOv8基础环境搭建cuda+anaconda+pytorch+pycharm

首先安装NVIDIA gpu的电脑安装显卡驱动,如果安装过了,或者想使用cpu的,可以跳过这一步。打开cmd,输入nvidia-smi查看GPU的CUDA版本,可以看到CUDA版本12.3,意味着只能安装小于12.3的CUDA版本。下载完成,进行安装,建议安装在非系统盘,以后会创建比较多的环境的话,剩下的默认安装即可。,需要注册一个NVIDIA账号,然后选择CUDA对应版本的cudnn即可。,以12.2.1版本举例,选好系统参数,点击下载,,以11.6版本举例,选好系统参数,点击下载,

qq_16602159的博客 2385

java算法题常用工具模板

目录标题输入与输出1.Scanner2.BufferReader数组初始化初始化一维数组初始化二维数组字符型的0-9数字转为int型数字:字符数组转字符串:数组拷贝数组与List互相转换数组转ListList转数组排序对List排序常用容器操作(对比C++ STL)1.vector 和 ArrayList2.pair 和 Pair3.string 和 String4.queue, stack, deque 和 Deque5.priority_queue 和 PriorityQueue6.unordered_

skLit8的博客 655

RK3399驱动开发 | 19 - 阿美林7寸mipi屏幕调试(基于linux4.4.194内核)

NULL

Mculover666的博客(嵌入式) 2670

基于YOLOv8改进的目标检测算法研究及毕设实现全流程指南

在PyTorch中定义改进后的YOLOv8模型。首先,导入相关的库和模块,然后定义骨干网络、颈部和头部的结构。# 这里定义骨干网络的结构,例如使用改进的CSP结构# 卷积层、批归一化层、激活函数等# 更多的卷积层、批归一化层、激活函数等# 其他层...# 其他层的输出...然后,定义颈部和头部的结构,类似地,将注意力机制和特征增强方法集成到模型中。本毕设以YOLOv8为基础,通过集成注意力机制、应用特征增强技术等方法,改进了目标检测算法。

m0_64661770的博客 347

通用的Android练习项目模板配置「常用工具类,项目结构,模板使用」

1 概述 作者:舍长III 原文链接: https://www.jianshu.com/p/cf6ce2139d94 为什么会有这篇文章呢,是因为我发现我以前在学习开发知识时,代码整理得太不好了。经常是会发生以前学习过的知识,现在却找不到代码在哪里的情况,于是又要重新开始。 因为Android开发涉及的内容很多,如果想要系统的去整理笔记的话,就必须要分文件夹,分项目进行管理。每个项目对应着不同...

Android 开发架构 508

Nuvoton NPCM845X SoC

摘要:NPCM845X是Nuvoton推出的第四代BMC片上系统,专为服务器管理设计。采用四核Arm Cortex-A35架构,集成安全启动机制和硬件级安全组件,支持OP-TEE可信执行环境。提供完整的信任链设计,从Boot ROM到Linux内核分层验证。具备丰富外设接口和管理功能,支持OpenBMC、IPMI 2.0等标准,适用于数据中心安全管控需求。

Linux内核架构师 108

项目管理模板_8套项目管理常用工具模板+30张项目管理思维导图(电子版)+30本项目管理电子书...

马上就要过年了,你的钱包还好吗?知乎Pc端点击“资料合集”就可以拿走资料啦,嘻嘻手可以剁,但学习不能停小编很担心,你们是不是连买书的钱都没有了……所以,我们决定化作双十二后的一股清流,为圈子里各位小伙伴们免费送出:项目管理终极大礼包!这个礼包价值真的太高了,它涵盖三个部分第一部分,是:8套项目管理常用工具模板第二部分,是:30本项目管理电子书(这些书你们要买全一定很贵)第三部分,是我们引以为豪的:...

weixin_39630880的博客 308

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

RU DOS版、EFI版32bit/64bit BIOS常用工具

DOS版、EFI版的RU工具,可用来查看IO、MEM、PCI、SMBIOS等资源。亲测在EFI SHELL下可用。

java常用工具类:java实现excel模板导入数据,允许模板中部分数据字段为空

java实现excel模板导入数据,允许模板中部分数据字段为空

m0_71817461的博客 650

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

java常用工具类:java实现Excel文件上传下载(模板)-hutool

java实现Excel文件上传下载(模板)-hutool

m0_71817461的博客 3676

Phi-4-mini-reasoning Chainlit插件市场:分享常用工具与Prompt模板

本文介绍了如何在星图GPU平台上自动化部署Phi-4-mini-reasoning镜像,并利用其强大的逻辑推理能力构建智能问答系统。该轻量级开源模型特别擅长数学推理和长文本处理,结合Chainlit插件市场提供的Prompt模板,可快速搭建适用于教育辅导、数据分析等场景的AI助手,显著提升复杂问题的解决效率。

weixin_29301059的博客 131

4.6-springboot 整合常用工具的简单例子

springboot 整合常用工具的简单例子 回到第一章:目录 文章目录springboot 整合常用工具的简单例子前言一、使用logback记录日志使用方法二、application.yml的多环境配置三、配置阿里数据源1、引入阿里数据源依赖2、application.yml中配置3、访问四、整合spring data jpa五、整合mybatis六、整合模板引擎thymeleaf七、使用SHA256加密密码八、使用拦截器和session检查用户登录九、使用切面编程处理http请求参数校验十、使用切面编

川流不息 574

时间管理>活动定义的常用工具

滚动式规划是一种渐进明细的规划方式,即对近期要完成的工作进行详细规划,而对远期工作则暂时只在WBS 的较高层次上进行粗略规划。而后,随着了解到更多的信息,近期即将实施的工作包就可以分解成具体的活动。WBS 中的每个工作包都需分解成活动,以便通过这些活动来完成相应的可交付成果。采用分解技术来定义活动,就是要把项目工作包分解成更小的、更易于管理的组成部分,即活动——为完成工作包而必须开展的工作。定义活动过程最终输出的是活动,而非可交付成果。标准活动清单或以往项目的部分活动清单,经常可用作新项目的模板。

huaqianzkh的专栏 338

实战篇、22、GC调优的常用工具

现在有时间了了,打算继续看 jvm , 因为 java 块的东西,才是我安身立命之本,其它 诸如 excel模板填充,计算机网络,网络安全,这些终究是锦上添花,后来跳槽去了岗顶,看flowable。之前在花都公司 看这个 jvm,后来跳槽去了白云,看 钉钉低代码。

qq_41577703的博客 162

【综合架构】Part 0.2 模板机基础优化

【综合架构篇】对模板机进行基础优化

m0_57945360的博客 353
上一篇: 了解Redis
下一篇: SpringCache(通用缓存)
要加油!
博客等级 码龄8年 468粉丝 46原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值