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

wordpress文章文件东莞seo报价

wordpress文章文件,东莞seo报价,自己注册公司有什么弊端,wordpress 备份云盘在springboot框架中下载服务器存储的图片: 1)springboot默认访问放行的目录只有static,在static目录下存放图片资源 2)编译后的static目录中有一个1.png 2.5)编写控制器: Controller //RequestMapping("/upload&q…

         在springboot框架中下载服务器存储的图片:

1)springboot默认访问放行的目录只有static,在static目录下存放图片资源

2)编译后的static目录中有一个1.png

 

2.5)编写控制器:

@Controller
//@RequestMapping("/upload")
public class UploadController {@RequestMapping("/download")public void download( String imgName,HttpServletRequest request,HttpServletResponse response) throws IOException {response.setContentType("image/png"); // 根据实际文件类型设置response.setHeader("Content-Disposition", "attachment; filename="+imgName);try {URL url = new URL("http://localhost:8080/upload/"+imgName);/*将网络资源地址传给,即赋值给url*//*此为联系获得网络资源的固定格式用法,以便后面的in变量获得url截取网络资源的输入流*/HttpURLConnection connection = (HttpURLConnection)url.openConnection();connection.setRequestMethod("GET");DataInputStream in = new DataInputStream(connection.getInputStream());/*此处也可用BufferedInputStream与BufferedOutputStream*/DataOutputStream out = new DataOutputStream(response.getOutputStream());/*将参数savePath,即将截取的图片的存储在本地地址赋值给out输出流所指定的地址*/byte[] buffer = new byte[4096];int count = 0;/*将输入流以字节的形式读取并写入buffer中*/while ((count = in.read(buffer)) > 0) {out.write(buffer, 0, count);}out.close();/*后面三行为关闭输入输出流以及网络资源的固定格式*/in.close();connection.disconnect();} catch (Exception e) {
//            System.out.println(e + fileUrl + savePath);
//            return null;System.out.println("上传异常"+e.getMessage());System.out.println(e);}}}

3)访问控制器

 

 自定义一个启动器:

1)创建一个Maven项目,在pom.xml文件中:

            一:所有启动器配置类的创建使用spring-boot-autoconfigure实现

            二:spring-boot-configuration-processor找到boot的配置文件实现映射.

<parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>2.4.11</version></parent><dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-autoconfigure</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-configuration-processor</artifactId><optional>true</optional></dependency></dependencies>

2)Maven目录结构:

        DiyProperties用来映射配置文件

        DiyBean用来装配diyProperties对象

        DiyConfigration是一个配置类容器,存放bean对象.



 

 DiyProperties:

package com.xja.start;import org.springframework.boot.context.properties.ConfigurationProperties;/*** @author rk* @description: TODO* @date 2024/8/13 21:19*/
@ConfigurationProperties(prefix = "mybatis"
)
public class DiyProperties {private Integer param;private String docuration;public DiyProperties() {}public DiyProperties(Integer param, String docuration) {this.param = param;this.docuration = docuration;}public Integer getParam() {return param;}public void setParam(Integer param) {this.param = param;}public String getDocuration() {return docuration;}public void setDocuration(String docuration) {this.docuration = docuration;}
}

 



 DiyBean:

package com.xja.bean;import com.xja.start.DiyProperties;/*** @author rk* @description: TODO* @date 2024/8/13 22:34*/
public class DiyBean {private DiyProperties properties;public DiyBean(DiyProperties properties) {this.properties = properties;}public DiyProperties getProperties() {return properties;}public void setProperties(DiyProperties properties) {this.properties = properties;}
}

 



DiyConfigration:

package com.xja.config;import com.xja.bean.DiyBean;
import com.xja.start.DiyProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;/*** @author rk* @description: TODO* @date 2024/8/13 22:29*/
@Configuration
@EnableConfigurationProperties({DiyProperties.class})
public class DiyConfigration {
//    @Autowired
//    private DiyBean diyBean;@Beanpublic DiyBean properties(DiyProperties diyProperties){return new DiyBean(diyProperties);}}

spring.factories:

        本Maven项目的配置文件,这个文件给springboot框架看的,boot框架会根据该配置文件实现对配置类的装配.

org.springframework.boot.autoconfigure.EnableAutoConfiguration=com.xja.config.DiyConfigration

3)安装并在其他项目启用启动器:

  安装:

启用:

        1)新建maven项目启用该坐标

        2)配置application.yml

        3)入口不要忘写了

        4)启动器,启动!

 

http://www.yidumall.com/news/55563.html

相关文章:

  • 做公司网站要多少钱seo知名公司
  • 哪个网站可以做ppt模板推广网站排名
  • 高校后勤网站建设要求宝鸡网站开发公司
  • 在婚恋网站做翻译好吗重庆快速排名优化
  • 医疗网站备案网络营销的背景和意义
  • 网站导航规划超级外链工具 增加外链中
  • 一站式网站手机端怎么做网络营销服务商有哪些
  • 网站开发服务费记账seo实战培训费用
  • asp网站制作实例教程网络营销技巧
  • 北京做网站的公司哪家好百度站长工具网站提交
  • 网站建设开发报价单seo的基本步骤顺序正确的是
  • 足彩网站怎样做推广营销型制作网站公司
  • 获取网站物理路径网络推广平台有哪些
  • 福田网站制作比较好的网络营销工具体系
  • 网站制作真人游戏娱乐平台怎么做优化大师客服
  • 获取网站全站代码外链代发免费
  • 可以做婚礼视频的网站有哪些国内最好用免费建站系统
  • 做的响应式网站用什么测试天津优化网络公司的建议
  • 无锡华诚建设监理有限公司网站怎么让某个关键词排名上去
  • 便宜虚拟主机做网站备份重庆seo排名扣费
  • 农产品网站建设长沙服务好的网络营销
  • 苏州中国建设银行招聘信息网站seo网站优化策划书
  • 网页设计制作工资专业搜索引擎seo技术公司
  • 网站建设工具沈阳seo优化排名公司
  • 如何让WordPress上传媒体北京seo关键词优化外包
  • 如何做有后台的网站手机网站智能建站
  • 福建省建设厅网站信用评分信息推广
  • 建立自己的购物网站谷歌play商店
  • 一个网站只有一个核心关键词fifa最新世界排名
  • asp.net免费网站潍坊关键词优化平台