java综合记录
1.nacos继承SpirngBoot做配置中心
spring配置文件里:
nacos.config.server-addr=127.0.0.1:8848
nacos.config.namespace=xxx
springboot启动类中:
@NacosPropertySource(dataId = "cds-node", groupId = "com.wasu.node", autoRefreshed = true)
然后
@NacosValue(value = "${useLocalCache:true}", autoRefreshed = true)即可
NACOS单机启动:sh startup.sh -m standalone
2.循环大法
//清空
stringBuilder.setLength(0);
for (IsColumnAsset columnAsset : whiteList) {
stringBuilder.append(stringBuilder.length() == 0 ? "" : ",");
stringBuilder.append("'").append(columnAsset.getAssetId()).append("'");
}
循环时多的在外层
3.mongoDB
线程数优化:
connections-per-host:客户端最大连接数,超过了将会被阻塞,默认100
threads-allowed-to-block-for-connection-multiplier:可被阻塞的线程数因子,默认值为5,如果connectionsPerHost
配置为10,那么最多能阻塞50个线程,超过50个之后就会收到一个异常
创建用户
使用哪个库,创建的用户就属于哪个库,当然,这个仅限于当前库的role
use admin
- db.createUser({user: 'admin', pwd: 'Button2015', roles: [{role:'read', db: 'admin'}]})
pom 本地引入jar包,如果不行就在引用模块再引入一次
<dependency>
<groupId>dingding</groupId>
<artifactId>dingding</artifactId>
<version>2.8</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/taobao-sdk-java-auto_1479188381469-20190628.jar</systemPath>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>lib</directory>
<targetPath>/BOOT-INF/lib/</targetPath>
<includes>
<include>**/*.jar</include>
</includes>
</resource>
</resources>
浙公网安备 33010602011771号