Springboot and Springcloud Configuration

Source: Internet
Author: User

1. Basic Configuration

#项目名称 (Access Path)

Server.context-path=/manager

#端口

server.port=8764

#session过期时间

Server.sessiontimeout=30

#服务名称

Spring.application.name=ribbon

Eureka.instance.hostname=${spring.cloud.client.ipaddress}

#注册中心地址

Eureka.client.serviceurl.defaultzone=http://admin:[email protected]:9501/eureka/

#表示是否将自己注册到Eureka Server
Eureka.client.registerwitheureka=false
#表示是否从Eureka Server to obtain registration information

Eureka.client.fetchregistry=true

#注册中心
eureka.client.serviceurl.defaultzone=http://${eureka.instance.hostname}:${server.port}/eureka/
#注册中心用户密码
Security.basic.enabled=true
Security.user.name=admin

security.user.password=123456

#使用IP注册
Eureka.instance.preferipaddress=true
Eureka.instance.instance-id=${spring.cloud.client.ipaddress}:${server.port}

#使用环境
Spring.profiles.active=dev

#服务调用超时
#请求处理的超时时间 (default 5s)
Ribbon. readtimeout=5000
#请求连接的超时时间 (default 2s)
Ribbon. connecttimeout=2000
#对所有操作请求都进行重试
Hello-service.ribbon.oktoretryonalloperations=false
#对当前实例的重试次数
Ribbon. Maxautoretries=0
#切换实例的重试次数
Ribbon. Maxautoretriesnextserver=0

#编码

Server.tomcat.uri-encoding=utf-8

Spring.http.encoding.charset=utf-8
Spring.http.encoding.enabled=true
Spring.http.encoding.force=true
Spring.messages.encoding=utf-8

2. Database

Datasource.driver-class-name=com.mysql.jdbc.driver
Datasource.username=admin
datasource.password=123456

datasource.url=jdbc:mysql://127.0.0.1:3306/db?characterencoding=utf-8&useunicode=true& Zerodatetimebehavior=converttonull&allowmultiqueries=true

#数据库配置start

Spring.datasource.type=com.alibaba.druid.pool.druiddatasource
#初始化大小
Spring.datasource.initial-size=5
#配置获取连接等待超时的时间
spring.datasource.max-wait=10000
#连接池最小空闲
Spring.datasource.min-idle=5
#最大
Spring.datasource.max-active=20
#配置间隔多久才进行一次检测, detects idle connections that need to be closed, in milliseconds
spring.datasource.time-between-eviction-runs-millis=30000
#配置一个连接在池中最小生存的时间, Unit is milliseconds
spring.datasource.min-evictable-idle-time-millis=600000
Spring.datasource.validation-query=select 1 from DUAL
Spring.datasource.test-while-idle=true
#spring. Datasource.test-on-borrow=false
#spring. Datasource.test-on-return=false

#打开PSCache, and specify the size of the Pscache on each connection
#spring. datasource.pool-prepared-statements=true
#spring. datasource.max-pool-prepared-statement-per-connection-size=20

#配置监控统计拦截的filters, remove the post-monitoring interface SQL cannot count wall for firewalls
spring.datasource.filters=stat,wall,log4j
#通过connectProperties属性来打开mergeSql功能; Slow SQL Records
spring.datasource.connection-properties=druid.stat.mergesql=true;druid.stat.slowsqlmillis=5000
# Merging monitoring data from multiple Druiddatasource
#spring. datasource.useglobaldatasourcestat=true
#数据库配置end

#druid登录用户名密码
Druid_loginusername=root
druid_loginpassword=123456



3. Log

#LOG
Logging.file=./logs/log.log
#日志级别
Logging.level.org.springframework=debug

Logging.level.com.creditlink.center.provider.dao=debug

4, Mybatis

#mybatis
Mybatis.mapper-locations=classpath:mybatis/mapper/*.xml

Mybatis.config-location=classpath:mybatis.xml

5. MongoDB
#spring. Data.mongodb.uri=mongodb://name:[email Protected]:37777/creditlink

Spring.data.mongodb.uri=mongodb://127.0.01:37777/creditlink

6. Redis

  1. Spring. Redis. Host=localhost
  2. Spring. Redis. port=6379
  3. #spring. redis.password=
  4. Spring. Redis. database=1
  5. Spring. Redis. Pool. Max-active=8
  6. Spring. Redis. Pool. max-wait=-1
  7. Spring. Redis. Pool. max-idle=
  8. Spring. Redis. Pool. min-idle=0
  9. Spring. Redis. timeout=0

Springboot and Springcloud Configuration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.