fastdfs java 连接池_GitHub - anniweiya/fastdfs-client: fastdfs连接池,支持spring,防盗链...

FastDFS连接池

使用common-pool2

直持spring

通过nginx进行http访问

支持防盗链

xmlns="http://www.springframework.org/schema/beans"

xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

spring boot

## application.yml

fastdfs:

g_connect_timeout: 60

g_network_timeout: 80

g_anti_steal_token: false

poolConfig:

maxTotal: 100

maxIdle: 10

protocol: http://

tracker_servers: 127.0.0.1:22122

g_tracker_http_port: 8080

nginx_address: 127.0.0.1:80

@Configuration

public class FastDfsConfig {

public static final String ROOT_CONFIG_PREFIX = "fastdfs";

@Resource

private FastDFSTemplateFactory fastDFSFactory;

@Bean(initMethod = "init")

@ConfigurationProperties(prefix = ROOT_CONFIG_PREFIX)

public FastDFSTemplateFactory fastDFSFactory() {

return new FastDFSTemplateFactory();

}

@Bean

public FastDFSTemplate fastDFSTemplate() {

return new FastDFSTemplate(fastDFSFactory);

}

}

如需要缩略图大小

可以参考nginx配置image_filter

location ~/group1/M00 {

alias /fastdfs/storage/data;

ngx_fastdfs_module;

set $flag '';

if ($args ~* "width=([1-9]\d*)") {

set $width $1;

set $flag "${flag}A";

}

if ($args ~* "height=([1-9]\d*)") {

set $height $1;

set $flag "${flag}B";

}

if ($flag != AB){

set $height 9999;

set $width 9999;

}

image_filter resize $width $height;

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值