Java 开发笔记2

Java获取参数名称

https://blog.csdn.net/z69183787/article/details/81117525

DefaultParameterNameDiscoverer().getParameterNames(real_bean_type.methods.first())

一些方法

加载的所有的Jar包

(Thread.currentThread().contextClassLoader as Launcher.AppClassLoader).urLs

获取类所在的Jar包

ComponentScan::class.java.protectionDomain.codeSource.location.file

启动参数

-Xmx 是VM参数 , 写到 jar 后面.
-jar 后面 两个减号是 jar 参数. 不能断.

限制线程数量:

java -Dloader.path=jar -Dfile.encoding=utf-8 -Xmx250m -jar xxx.jar --server.undertow.io-threads=16 --server.undertow.worker-threads=32 --server.dbIp=localhost

动态化注解配置.

@Configuration
@EnableScheduling
@ConditionalOnProperty(prefix = "scheduling", name="enabled", havingValue="true", matchIfMissing = true)
public class SchedulerConfig {

}

这样就让定时任务实现参数化.

posted @ 2018-11-20 15:25  NewSea  阅读(573)  评论(0编辑  收藏  举报