fix initialize

master
yixian 4 years ago
parent 4b89d6c389
commit 1356a61044

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

Loading…
Cancel
Save