springboot集成阿里云ocr

本文介绍了如何在SpringBoot项目中集成阿里云OCR服务,包括配置AliyunOcrConfig,编写测试用例,配置spring.factories文件,上传到私服,以及在其他工程中引入并配置阿里云参数。示例展示了在Controller中的简单应用,强调只需注入OCR模块的client并在业务代码中实现识别方法。
摘要由CSDN通过智能技术生成

我们ocr单独的工程,其他需要的时候直接引入该工程依赖。大致粗略写写,以后用到直接复制。

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

/**
 * JavaMail 配置属性
 *
 * @author Michelle.Chung
 */
@Data
@ConfigurationProperties(prefix = "ocr.aliyun")
public class AliyunOcrProperties {

    private String accessKeyID;
    private String accessKeySecret;
    private String endpoint;
}

AliyunOcrConfig.java

import com.aliyun.auth.credentials.Credential;
import com.aliyun.auth.credentials.provider.StaticCredentialProvider;
import com.aliyun.sdk.service.ocr_api20210707.AsyncClient;
import com.xhj.ocr.config.properties.AliyunOcrProperties;
import darabonba.core.client.ClientOverrideConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bea
  • 8
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值