溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶(hù)服務(wù)條款》

application.properties配置文件的方法

發(fā)布時(shí)間:2021-06-22 15:53:06 來(lái)源:億速云 閱讀:361 作者:chen 欄目:大數(shù)據(jù)

這篇文章主要介紹“application.properties配置文件的方法”,在日常操作中,相信很多人在application.properties配置文件的方法問(wèn)題上存在疑惑,小編查閱了各式資料,整理出簡(jiǎn)單好用的操作方法,希望對(duì)大家解答”application.properties配置文件的方法”的疑惑有所幫助!接下來(lái),請(qǐng)跟著小編一起來(lái)學(xué)習(xí)吧!

項(xiàng)目接口文檔

application-base.properties 基礎(chǔ)配置文件說(shuō)明:

#--------------------------------DUBBO---------------------------------#

nacos.home.conf=10.1xx.xx.231:8848
dubbo.application.logger=slf4j
dubbo.application.qos.enable=false
dubbo.application.qos.port=22222
dubbo.application.qos.accept.foreign.ip=false

#項(xiàng)目啟動(dòng)掃描包目錄
dubbo.scan.basePackages=top.suven
dubbo.scan.base-packages=top.suven
#微服務(wù)器注冊(cè)中心,可以使用zookeeper,也可以使用nacos做為微服務(wù)的注冊(cè)中心
#dubbo.registry.address=zookeeper://192.168.170.37:2181?backup=192.168.170.37:2182,192.168.170.37:2183
dubbo.registry.address = nacos://10.1xx.xx..231:8848?backup=10.10.10.231:8848
dubbo.jetty.directory=/data/applogs/monitor 
#服務(wù)器地址
spring.cloud.nacos.config.server-addr=127.0.01:8848
#默認(rèn)為Public命名空間,可以省略不寫(xiě)
spring.cloud.nacos.config.namespace=top.suven
#指定配置群組 --如果是Public命名空間 則可以省略群組配置
spring.cloud.nacos.config.group=video_group
#文件名 -- 如果沒(méi)有配置則默認(rèn)為 ${spring.application.name}
spring.cloud.nacos.config.prefix=member


# 微服務(wù)器部署 dubbo生產(chǎn)端組
dubbo.provider.group=DEV
# 微服務(wù)器部署 dubbo生產(chǎn)端組版本號(hào)
dubbo.provider.version=1.0.0
dubbo.provider.dispatcher=message

# 微服務(wù)器部署 dubbo消費(fèi)端組
dubbo.consumer.group=DEV
# 微服務(wù)器部署 dubbo消費(fèi)端組版本號(hào)
dubbo.consumer.version=1.0.0
# 微服務(wù)器部署 dubbo消費(fèi)端組版本號(hào)
dubbo.consumer.timeout=60000
# 微服務(wù)器部署 dubbo消費(fèi)端是否檢查可用性
dubbo.consumer.check=false
# 微服務(wù)器部署 dubbo消費(fèi)端組 是否懶加載
dubbo.consumer.lazy=true

dubbo.protocol.name=dubbo
dubbo.protocol.accepts=200
dubbo.protocol.threads=200
dubbo.protocol.threadpool=cached

#監(jiān)控服務(wù)
#dubbo.monitor.protocol=registry

#top.dubbo.sentinel.dashboardServer=192.1xx.xx..37:8866
#top.dubbo.sentinel.openFlow=true
#top.dubbo.sentinel.logPath=/data/webapps/hsz/dubbo-sentinel-log

#-----------------------------------END---------------------------------#

#-----------------------------------nacos start---------------------------------#

nacos.config.server-addr = 10.10.10.231:8848

#-----------------------------------nacos END---------------------------------#

#--------------------------------PROJECT--------------------------------#
####Jetty properties########
# acceptor線程數(shù),生產(chǎn)環(huán)境建議是64
#server.jetty.acceptors=2
## selector線程數(shù),生產(chǎn)環(huán)境建議是64
#server.jetty.selectors=8
# put或post方法最大字節(jié)數(shù)
server.max-http-header-size=1000
server.jetty.max-http-post-size=1000
server.servlet.context-path=/top

#配置文件傳輸
spring.servlet.multipart.enabled = true
spring.servlet.multipart.file-size-threshold = 0
#單個(gè)文件的最大上限
spring.servlet.multipart.max-file-size = 10MB
#單個(gè)請(qǐng)求的文件總大小上限
spring.servlet.multipart.max-request-size=1000MB

#服務(wù)基本目錄
top.jetty.server.documentRoot=/data/server
#服務(wù)最小線程池?cái)?shù)
top.jetty.server.threadPool.minThreads=8
#服務(wù)最大線程池:建議:1000
top.jetty.server.threadPool.maxThreads=200
#服務(wù)最大線程池:建議:3000
top.jetty.server.threadPool.idleTimeout=3000
#是否在調(diào)用void dump(Appendable out, String indent)是輸出更詳細(xì)的信息:建議:false
top.jetty.server.threadPool.detailedDump=false

#運(yùn)行服務(wù)監(jiān)控?cái)?shù)據(jù)上報(bào)
top.jetty.server.lowResources.period=1000
top.jetty.server.lowResources.idleTimeout=200
top.jetty.server.lowResources.monitorThreads=true
top.jetty.server.lowResources.maxConnections=10
top.jetty.server.lowResources.maxMemory=1000
top.jetty.server.lowResources.maxLowResourcesTime=5000



#微服服務(wù)隔斷哨兵模塊
top.async.asyncCorePoolSize=20
top.async.asyncMaxPoolSize=128
top.async.asyncQueueCapacity=500
top.async.asyncThreadNamePrefix=spring-async-thread-
top.async.keepAliveSeconds=60
top.async.allowCoreThreadTimeOut=false
top.async.poolSize=64
#-----------------------------------END---------------------------------#

#--------------------------------DOS FILTER  START--------------------------------#
#防dos 攻擊攔截實(shí)現(xiàn)配置
top.jetty.filter.dos.enabled=true
top.jetty.filter.dos.config.urlPatterns=/top/*,/server/*
top.jetty.filter.dos.config.exclusions=*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*
top.jetty.filter.dos.config.delayMs=-1
top.jetty.filter.dos.config.throttledRequests=5
top.jetty.filter.dos.config.maxRequestsPerSec=20
top.jetty.filter.dos.config.remotePort=true
top.jetty.filter.dos.config.maxWaitMs=50
top.jetty.filter.dos.config.maxRequestMs=30000
top.jetty.filter.dos.config.maxIdleTrackerMs=30000


#-----------------------------------DOS FILTER  END---------------------------------#
#--------------------------------Login Type----------------------------#
###SESSION,TOKEN,ALL
#驗(yàn)證服務(wù)登陸信息與方式
top.server.param.validType=TOKEN
top.server.param.logAop=false
#參數(shù)驗(yàn)證開(kāi)啟: true /false
top.server.param.checkParamSign=true
#-----------------------------------END---------------------------------#

application-db.properties 基礎(chǔ)配置文件說(shuō)明:

#-----------------------------------datasource--------------------------------------
#數(shù)據(jù)庫(kù)統(tǒng)計(jì)規(guī)范的配置文件

top.datasource.druid.config.enabled=true
top.datasource.druid.slave.enabled=true

#top.datasource.druid.url: jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=utf8&emptyStringsConvertToZero=true
#top.datasource.druid.username: root
#top.datasource.druid.password: root
# com.mysql.jdbc.Driver
top.datasource.druid.enum.class=com.ds.live.base.core.db.DataSourceGroupEnum.class
top.datasource.druid.initialize=true 
top.datasource.druid.dbType= mysql
top.datasource.druid.type = com.alibaba.druid.pool.DruidDataSource
top.datasource.druid.driver-class-name =com.mysql.cj.jdbc.Driver 
top.datasource.druid.filters = stat
top.datasource.druid.max-active = 20
top.datasource.druid.initial-size = 1
top.datasource.druid.min-idle = 3
top.datasource.druid.max-wait = 600
top.datasource.druid.time-between-eviction-runs-millis = 60000
top.datasource.druid.min-evictable-idle-time-millis = 300000
top.datasource.druid.validationQuery = select 'x';
top.datasource.druid.test-while-idle = true
top.datasource.druid.test-on-borrow = true
top.datasource.druid.test-on-return = true
top.datasource.druid.pool-prepared-statements = true



spring.datasource.druid.stat-view-servlet.enabled=false
spring.datasource.druid.statViewServlet.urlPattern=/druid/*
# \u767D\u540D\u5355\uFF1A
#spring.datasource.druid.statViewServlet.allow=
#  IP\u9ED1\u540D\u5355 (\u5B58\u5728\u5171\u540C\u65F6\uFF0Cdeny\u4F18\u5148\u4E8Eallow) : \u5982\u679C\u6EE1\u8DB3deny\u7684\u8BDD\u63D0\u793A:Sorry, you are not permitted to view this page.
#spring.datasource.druid.statViewServlet.deny=
spring.datasource.druid.statViewServlet.loginUsername=admin
spring.datasource.druid.statViewServlet.loginPassword=123456
# \u662F\u5426\u80FD\u591F\u91CD\u7F6E\u6570\u636E.
spring.datasource.druid.statViewServlet.resetEnable=false


spring.datasource.druid.web-stat-filter.enabled=false
spring.datasource.druid.webStatFilter.sessionStatEnable=false
spring.datasource.druid.webStatFilter.profileEnable=false
spring.datasource.druid.webStatFilter.urlPattern=/*
spring.datasource.druid.webStatFilter.exclusions="*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*,/server/druid/*

spring.filter.dos.urlPatterns=/server/*
spring.filter.dos.exclusions=/druid/*,/server/druid/*

#-------------------------------------END--------------------------------------

application-redis.properties redis配置文件說(shuō)明:

#---------------------------------REDIS---------------------------------#
# 數(shù)據(jù)表對(duì)象是否緩存到redis 開(kāi)關(guān),默認(rèn)為true
top.redis.cluster.client.daoOpen=true

# 數(shù)據(jù)表對(duì)象是否寫(xiě)入緩存到redis 開(kāi)關(guān),
top.redis.cluster.client.write=true
# 數(shù)據(jù)表對(duì)象是否讀取緩存到redis 開(kāi)關(guān),
top.redis.cluster.client.read=true


#redis 連接池配置參數(shù)文件
top.redis.cluster.enabled=true
top.redis.cluster.timeout = 10000
top.redis.cluster.pool.maxTotal= 1000
top.redis.cluster.pool.maxIdle= 100
top.redis.cluster.pool.minIdle= 10
top.redis.cluster.pool.maxWaitMillis= 1000
top.redis.cluster.pool.timeout= 10000
top.redis.cluster.pool.maxRedirections= 2
top.redis.cluster.pool.testOnBorrow= true
top.redis.cluster.pool.testOnReturn= true
#------------------------------------END----------------------------------#

# redis 多聚群配置實(shí)現(xiàn);參考 RedisClusterEnum 配置;
top.redis.cluster.servers=10.1xx.xx.231:7001;10.1xx.xx.231:7002;10.1xx.xx.231:7003;10.1xx.xx.231:7004;10.1xx.xx.231:7005;10.1xx.xx.231:7006
#top.redis.cluster.password=8Er^_QrO
top.redis.cluster.servers.one=10.1xx.xx.231:7001;10.1xx.xx.231:7002;10.1xx.xx.231:7003;10.1xx.xx.231:7004;10.1xx.xx.231:7005;10.1xx.xx.231:7006
#top.redis.cluster.password.one=8Er^_QrO

application-mq.properties 異步消息mq配置文件說(shuō)明:

# 項(xiàng)目提供和聚群微服務(wù)的架構(gòu),包括日志服elk, 大數(shù)據(jù)分析采摘kafka, 服務(wù)間解籍服務(wù)rocketmq
#-----------------------------------kafka--------------------------------------
# kafka service config status : true/false
top.kafka.config.enabled=false
# kafka service producer status : true/false
top.kafka.producer.enabled=true
# top.kafka.producer (acks:0,1,-1(all))
top.kafka.producer.acks=0
top.kafka.producer.retries= 0
top.kafka.producer.batchSize= 6384
top.kafka.producer.bufferMemory=33554432
top.kafka.producer.lingerMs=1
top.kafka.producer.maxBlockMs=1000
top.kafka.producer.keySerializer= org.apache.kafka.common.serialization.StringSerializer
top.kafka.producer.valueSerializer= org.apache.kafka.common.serialization.StringSerializer
top.kafka.producer.bootstrapServers=  10.100.0.222:9092

# top.kafka.consumer
# kafka service consumer status : true/false
top.kafka.consumer.enabled=true
top.kafka.consumer.groupId = top
top.kafka.consumer.sessionTimeoutMs= 30000
top.kafka.consumer.enableAutoCommit =true
top.kafka.consumer.autoCommitIntervalms =100
top.kafka.consumer.pollTimeout =100
top.kafka.consumer.concurrency=2
top.kafka.consumer.autoOffsetReset = earliest
top.kafka.consumer.keyDeserializer =org.apache.kafka.common.serialization.StringDeserializer
top.kafka.consumer.valueDeserializer = org.apache.kafka.common.serialization.StringDeserializer
top.kafka.consumer.bootstrapServers = 10.100.0.222:9092
#--------------------------------------END--------------------------------------

#-----------------------------ROCKER-MQ---------------------------------#
top.rocketmq.config.enabled=false
top.rocketmq.nameSrvAdds=10.100.0.222:9876
top.rocketmq.maxMessageSize=131072
top.rocketmq.sendMsgTimeout=3000
top.rocketmq.retryTimesWhenSendFailed=2
top.rocketmq.consumeThreadMin=20
top.rocketmq.consumeThreadMax=64

top.rocketmq.delayTimeLevel=2
top.rocketmq.client.logLevel=INFO
top.rocketmq.client.logRoot=/data/server/rocket-mq-log
top.rocketmq.client.logFileMaxIndex=10



spring.rocketmq.producer.enabled=false
spring.rocketmq.nameServer= 10.100.0.222:9876
spring.rocketmq.producer.retry-times-when-send-async-failed=0
spring.rocketmq.producer.send-msg-timeout=300000
spring.rocketmq.producer.compress-msg-body-over-howmuch=4096
spring.rocketmq.producer.max-message-size=4194304
spring.rocketmq.producer.retry-another-broker-when-not-store-ok=false
spring.rocketmq.producer.retry-times-when-send-failed=3
spring.rocketmq.producer.group=TEST_AUTH
spring.rocketmq.consumer.enabled=false
#----------------------------------END-----------------------------------#

#-----------------------------ACTIVITY-MQ--------------------------------#
#spring.activemq.broker-url=failover:(tcp://10.100.0.253:61616)?maxReconnectDelay=5000&timeout=1000
#spring.activemq.user=system
#spring.activemq.password=manager
#spring.activemq.packages.trust-all=false
#spring.activemq.pool.enabled=false
##spring.activemq.pool.expiry-timeout=0
##spring.activemq.pool.idle-timeout=3000
#spring.activemq.pool.max-connections=20
#-------------------------------END--------------------------------------#

到此,關(guān)于“application.properties配置文件的方法”的學(xué)習(xí)就結(jié)束了,希望能夠解決大家的疑惑。理論與實(shí)踐的搭配能更好的幫助大家學(xué)習(xí),快去試試吧!若想繼續(xù)學(xué)習(xí)更多相關(guān)知識(shí),請(qǐng)繼續(xù)關(guān)注億速云網(wǎng)站,小編會(huì)繼續(xù)努力為大家?guī)?lái)更多實(shí)用的文章!

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI