Merge branch 'develop'

master
yixian 4 years ago
commit 8c02412012

@ -4,15 +4,13 @@ import com.alibaba.fastjson.parser.ParserConfig;
import com.google.code.kaptcha.Producer;
import com.google.code.kaptcha.impl.DefaultKaptcha;
import com.google.code.kaptcha.util.Config;
import com.maxmind.geoip.LookupService;
import com.mongodb.MongoClientOptions;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.autoconfigure.mongo.MongoClientSettingsBuilderCustomizer;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.core.io.Resource;
@ -23,6 +21,7 @@ import java.io.IOException;
import java.util.Properties;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
/**
* exclude = {DataSourceAutoConfiguration.class}
@ -78,7 +77,9 @@ public class PaymentManageApplication {
}
@Bean
public MongoClientOptions mongoOptions() {
return MongoClientOptions.builder().maxConnectionIdleTime(6000).socketTimeout(3000).maxWaitTime(3000).serverSelectionTimeout(3000).build();
public MongoClientSettingsBuilderCustomizer mongoOptions() {
return builder -> builder.applyToConnectionPoolSettings(config -> config.maxWaitTime(3, TimeUnit.SECONDS)
.maxConnectionIdleTime(6, TimeUnit.SECONDS)
).applyToSocketSettings(config -> config.connectTimeout(3, TimeUnit.SECONDS));
}
}

Loading…
Cancel
Save