yml配置信息读取
ymlSprintBoot原创yml大约 1 分钟约 354 字
读取yml配置信息
@Component
@ConfigurationProperties(prefix = "gen")
@PropertySource(value = { "classpath:generator.yml" })
public class GenConfig
{
/** 作者 */
public static String author;
/** 生成包路径 */
public static String packageName;
/** 自动去除表前缀,默认是false */
public static boolean autoRemovePre;
/** 表前缀(类名不会包含表前缀) */
public static String tablePrefix;
public static String getAuthor()
{
return author;
}
@Value("${author}")
public void setAuthor(String author)
{
GenConfig.author = author;
}
public static String getPackageName()
{
return packageName;
}
@Value("${packageName}")
public void setPackageName(String packageName)
{
GenConfig.packageName = packageName;
}
public static boolean getAutoRemovePre()
{
return autoRemovePre;
}
@Value("${autoRemovePre}")
public void setAutoRemovePre(boolean autoRemovePre)
{
GenConfig.autoRemovePre = autoRemovePre;
}
public static String getTablePrefix()
{
return tablePrefix;
}
@Value("${tablePrefix}")
public void setTablePrefix(String tablePrefix)
{
GenConfig.tablePrefix = tablePrefix;
}
}
tomcat配置
server:
# 服务端口
port: 8080
# Tomcat
tomcat:
# 链接建立超时时间(单位:ms)
connection-timeout: 12000
# uri编码
uri-encoding: UTF-8
# 最小线程数:SpringBoot启动时初始化的线程数量
min-spare-threads: 100
# 最大线程数:可以设为CPU线程数的200~250倍
max-threads: 500
# 最大等待队列长度:每个请求使用一个线程,线程数超过最大链接数后请求会进入等待队列,直到有线程处理
accept-count: 1000
# 最大链接数:Tomcat同一时间能接受的最大线程数量,需要大于 max-threads + accept-count
max-connections: 1500
# 请求头最大长度(单位:KB)1048576KB=1GB
max-http-header-size: 1048576
# 请求体最大长度(单位:KB)2097152=2GB
max-http-post-size: 2097152
accesslog:
enabled: true
directory: ./ruoyi/logs