当前位置: 首页 > news >正文

网站设计是干什么的怎么查询自己房产信息

网站设计是干什么的,怎么查询自己房产信息,免费ppt模板app有哪些,discuz网站开发文章目录 阿里云 OSS 介绍准备工作SpringBoot 集成 OSS 阿里云 OSS 介绍 阿里云对象存储 OSS #xff08;Object Storage Service#xff09;#xff0c;是一款海量、安全、低成本、高可靠的云存储服务。使用 OSS#xff0c;你可以通过网络随时存储和调用包括文本、图片、… 文章目录 阿里云 OSS 介绍准备工作SpringBoot 集成 OSS 阿里云 OSS 介绍 阿里云对象存储 OSS Object Storage Service是一款海量、安全、低成本、高可靠的云存储服务。使用 OSS你可以通过网络随时存储和调用包括文本、图片、音频和视频等在内的各种文件。 准备工作 登录阿里云后进入阿里云控制台首页选择 对象存储 OSS 服务 开通服务 创建Bucket 填写 bucket 名称 选存储空间归属的地域 选择读写权限为公共读 4. 获取密钥 创建 AccessKey 保存 AccessKey ID 和 AccessKey Secret SpringBoot 集成 OSS 可以参考 官网 SDK 文档 导入 maven 坐标 dependencygroupIdcom.aliyun.oss/groupIdartifactIdaliyun-sdk-oss/artifactIdversion${aliyun.sdk.oss}/version /dependency dependencygroupIdjavax.xml.bind/groupIdartifactIdjaxb-api/artifactIdversion${jaxb-api}/version /dependency如果是 Java 9 及以上版本还需要导入其他坐标 在 yml 中添加配置 对应的配置类 编写 AliOssUtil Data AllArgsConstructor Slf4j public class AliOssUtil {private String endpoint;private String accessKeyId;private String accessKeySecret;private String bucketName;/*** 文件上传** param bytes* param objectName* return*/public String upload(byte[] bytes, String objectName) {// 创建OSSClient实例。OSS ossClient new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);try {// 创建PutObject请求。ossClient.putObject(bucketName, objectName, new ByteArrayInputStream(bytes));} catch (OSSException oe) {System.out.println(Caught an OSSException, which means your request made it to OSS, but was rejected with an error response for some reason.);System.out.println(Error Message: oe.getErrorMessage());System.out.println(Error Code: oe.getErrorCode());System.out.println(Request ID: oe.getRequestId());System.out.println(Host ID: oe.getHostId());} catch (ClientException ce) {System.out.println(Caught an ClientException, which means the client encountered a serious internal problem while trying to communicate with OSS, such as not being able to access the network.);System.out.println(Error Message: ce.getMessage());} finally {if (ossClient ! null) {ossClient.shutdown();}}//文件访问路径规则 https://BucketName.Endpoint/ObjectNameStringBuilder stringBuilder new StringBuilder(https://);stringBuilder.append(bucketName).append(.).append(endpoint).append(/).append(objectName);log.info(文件上传到:{}, stringBuilder.toString());return stringBuilder.toString();} }配置 OSS Configuration /*** 配置类用于创建AliOssUtil对象*/ Configuration Slf4j public class OssConfiguration {BeanConditionalOnMissingBeanpublic AliOssUtil aliOssUtil(AliOssProperties aliOssProperties){log.info(开始创建阿里云文件上传工具类对象{}, aliOssProperties);return new AliOssUtil(aliOssProperties.getEndpoint(),aliOssProperties.getAccessKeyId(),aliOssProperties.getAccessKeySecret(),aliOssProperties.getBucketName());} }编写通用上传文件接口 /*** 通用接口*/ RestController RequestMapping(/admin/common) Api(tags 通用接口) Slf4j public class CommonController {Autowiredprivate AliOssUtil aliOssUtil;PostMapping(/upload)ApiOperation(文件上传)public ResultString upload(MultipartFile file){log.info(文件上传{}, file);try {// 原始文件名String originalFilename file.getOriginalFilename();// 后缀String extension originalFilename.substring(originalFilename.lastIndexOf(.));String objectName UUID.randomUUID().toString() extension;// 文件的请求路径String filePath aliOssUtil.upload(file.getBytes(), objectName);return Result.success(filePath);} catch (IOException e) {log.error(文件上传失败{}, e);}return Result.error(MessageConstant.UPLOAD_FAILED);} }上传文件到 OSS 从前端调用上面的上传文件的接口就可以将文件上传到 OSS 上并且获取到访问 OSS 文件路径的 URL 地址。
http://www.pierceye.com/news/591680/

相关文章:

  • 招聘wordpress网站高手兼职wordpress会员付费插件
  • 网站建设综合报告威海网站建设兼职
  • 做的网站浏览器提示不安全网站开发四川
  • 高端网站设计有哪些企业网站开发php
  • php网站模块网站建设协议 模板
  • 怎么做像知乎一样的网站网络营销案例分析模板
  • 网站开发 h5 h4网站运作模式
  • 竞彩网站开发那些市区做网站群
  • 建投五公司网站找苏州网站建设
  • 徐州IT兼职网站开发中国做陶壶的网站有哪些
  • WordPress模板转换typecho郑州搜索引擎优化
  • 个人怎么做贷款网站什么是网络营销产品
  • 网站你的后台管理系统用什么做外包公司与劳务派遣区别
  • 设计师资源网站价格低油耗低的车
  • 中山快速做网站服务wordpress建站ftp
  • 做酒类直供网站行吗网站seo检测报告
  • 南昌建站费用网站建设出错1004
  • 十堰做网站的公司阿里巴巴外贸网站论坛
  • 品牌网站建设代理网站建设公司易下拉软件
  • 移动网站模板响应式网站开发教程pdf
  • 怎么设计网站内容小程序seo帝搜软件sem880官网
  • 十堰秦楚网 十堰新闻门户网站wordpress 点赞 开启
  • 做外贸网站需要注意些什么手续安阳吧贴吧
  • 国外申请域名的网站百度标记号码认证平台
  • 专门做淘宝代运营的网站支付建设网站的费用什么科目
  • 天津企业设计网站建设建个网站做外贸
  • 申请永久网站空间wordpress论坛采集
  • 网站如何做竞价佛山新网站建设机构
  • 网站建设费可以一次性冲费用吗学校门户网站作用
  • 手机上怎么制作网站音乐网站如何建立