application.properties配置文件的方法
这篇文章主要介绍“application.properties配置文件的方法”,在日常操作中,相信很多人在application.properties配置文件的方法问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”application.properties配置文件的方法”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!
成都创新互联公司总部坐落于成都市区,致力网站建设服务有成都网站制作、网站建设、网络营销策划、网页设计、网站维护、公众号搭建、微信平台小程序开发、软件开发等为企业提供一整套的信息化建设解决方案。创造真正意义上的网站建设,为互联网品牌在互动行销领域创造价值而不懈努力!
项目接口文档
application-base.properties 基础配置文件说明:
#--------------------------------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 #项目启动扫描包目录 dubbo.scan.basePackages=top.suven dubbo.scan.base-packages=top.suven #微服务器注册中心,可以使用zookeeper,也可以使用nacos做为微服务的注册中心 #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 #服务器地址 spring.cloud.nacos.config.server-addr=127.0.01:8848 #默认为Public命名空间,可以省略不写 spring.cloud.nacos.config.namespace=top.suven #指定配置群组 --如果是Public命名空间 则可以省略群组配置 spring.cloud.nacos.config.group=video_group #文件名 -- 如果没有配置则默认为 ${spring.application.name} spring.cloud.nacos.config.prefix=member # 微服务器部署 dubbo生产端组 dubbo.provider.group=DEV # 微服务器部署 dubbo生产端组版本号 dubbo.provider.version=1.0.0 dubbo.provider.dispatcher=message # 微服务器部署 dubbo消费端组 dubbo.consumer.group=DEV # 微服务器部署 dubbo消费端组版本号 dubbo.consumer.version=1.0.0 # 微服务器部署 dubbo消费端组版本号 dubbo.consumer.timeout=60000 # 微服务器部署 dubbo消费端是否检查可用性 dubbo.consumer.check=false # 微服务器部署 dubbo消费端组 是否懒加载 dubbo.consumer.lazy=true dubbo.protocol.name=dubbo dubbo.protocol.accepts=200 dubbo.protocol.threads=200 dubbo.protocol.threadpool=cached #监控服务 #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线程数,生产环境建议是64 #server.jetty.acceptors=2 ## selector线程数,生产环境建议是64 #server.jetty.selectors=8 # put或post方法最大字节数 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 #单个文件的最大上限 spring.servlet.multipart.max-file-size = 10MB #单个请求的文件总大小上限 spring.servlet.multipart.max-request-size=1000MB #服务基本目录 top.jetty.server.documentRoot=/data/server #服务最小线程池数 top.jetty.server.threadPool.minThreads=8 #服务最大线程池:建议:1000 top.jetty.server.threadPool.maxThreads=200 #服务最大线程池:建议:3000 top.jetty.server.threadPool.idleTimeout=3000 #是否在调用void dump(Appendable out, String indent)是输出更详细的信息:建议:false top.jetty.server.threadPool.detailedDump=false #运行服务监控数据上报 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 #微服服务隔断哨兵模块 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 攻击拦截实现配置 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 #验证服务登陆信息与方式 top.server.param.validType=TOKEN top.server.param.logAop=false #参数验证开启: true /false top.server.param.checkParamSign=true #-----------------------------------END---------------------------------#
application-db.properties 基础配置文件说明:
#-----------------------------------datasource-------------------------------------- #数据库统计规范的配置文件 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配置文件说明:
#---------------------------------REDIS---------------------------------# # 数据表对象是否缓存到redis 开关,默认为true top.redis.cluster.client.daoOpen=true # 数据表对象是否写入缓存到redis 开关, top.redis.cluster.client.write=true # 数据表对象是否读取缓存到redis 开关, top.redis.cluster.client.read=true #redis 连接池配置参数文件 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 多聚群配置实现;参考 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配置文件说明:
# 项目提供和聚群微服务的架构,包括日志服elk, 大数据分析采摘kafka, 服务间解籍服务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--------------------------------------#
到此,关于“application.properties配置文件的方法”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注创新互联网站,小编会继续努力为大家带来更多实用的文章!
新闻标题:application.properties配置文件的方法
文章出自:http://pwwzsj.com/article/gipihs.html