赞
踩
*中文乱码 settings->file Encodings
server.port=8080 #指定端口号 debug=true #开启debug模式 spring.profiles.active=dev #指定激活使用的配置文件 spring.config.location=path_url #使用指定路径下的配置文件项 可以配置命令行模式 --spring.config.location=path_url server.servlet.context-path=/boot #配置项目的访问模块路径 spring.datasource.url=jdbc:mysql://127.0.0.1:3306/jdbc?useSSL=false spring.datasource.username=root spring.datasource.password=root #初始化线程池大小 spring.datasource.druid.initial-size= #最大线程池大小 spring.datasource.druid.max-active= mybatis.mapper-locations=classpath:mappers/*.xml mybatis-plus.mapper-locations=classpath:mappers/*.xml logging.level.cn.tedu=debug spring.http.encoding.enabled=true spring.http.encoding.charset=UTF-8 spring.http.encoding.force=true 强制编码 #日志输出级别level后的参数是包 logging.level.com.example.spring_initializr_demo=trace #输出到指定目录 logging.path= #输出到指定文件 权重大于path设置 logging.file= #控制台输出日志格式 logging.pattern.console= #文件输出日志格式 logging.pattern.file= #国际化消息文件配置路径使用/不是.不然会产生??问题 spring.messages.basename=i18n/login #thymeleaf模版缓存是否启用 spring.thymeleaf.cache=false #时间日期格式化器配置 spring.mvc.date-format=yyyy-MM-dd #视图拼接前缀目录 spring.mvc.view.prefix=/WEB-INF/ #视图拼接后缀 spring.mvc.view.suffix=.jsp #tomcat 设置编码 server.tomcat.uri-encoding=UTF-8 #rabbitmq 消息队列配置 spring.rabbitmq.host=192.168.240.180 spring.rabbitmq.username=guest spring.rabbitmq.password=guest #elasticsearch 相关配置 spring.elasticsearch.jest.uris=http://192.168.240.180:9201 spring.data.elasticsearch.cluster-name=elasticsearch spring.data.elasticsearch.cluster-nodes=192.168.240.180:9301 #mail发送邮件相关配置 spring.mail.username=1135636204@qq.com spring.mail.password=you auth code spring.mail.host=smtp.qq.com spring.mail.properties.mail.smtp.ssl.enable=true #排除自动配置时的加载项 spring.autoconfigure.exclude= #文件上传大小 spring.servlet.multipart.max-file-size=100MB #多文件总大小 spring.servlet.multipart.max-request-size=200MB #将指定目录设为静态资源文件目录 spring.web.resources.static-locations=file:D:/picture,classpath:static ##关闭cglib代理使用JDK代理 spring.aop.proxy-target-class=false
(双引号解析特殊符号 单引号直接输出所有原内容)
server: port: 8080 servlet: encoding: #编码格式 force: true #是否强制 charset: UTF-8 #设置字符集编码 mybatis: config-location: classpath:mybatis/mybatis-config.xml #指定全局配置文件位置 mapper-locations: classpath:mybatis/mapper/*.xml #指定sql映射文件位置 configuration: map-underscore-to-camel-case: true #设置为列名允许映射驼峰命名法 log-impl: org.apache.ibatis.logging.stdout.StdOutImpl #设置sql日志打印模版 mybatis-plus: mapper-locations: classpath:mappers/**/*.xml #日志 logging: level: cn.tedu.tea: trace #包名加级别 #数据库帐号 密码 链接地址配置 链接数据引擎类型 spring: application: name: name profiles: active: dev #指定合并其他配置环境文档配置 daily(日常) test(测试) pre(预发) publish/dev(正式) #命令行模式:--spring.profiles.active=dev #VM模式:-Dspring.profiles.active=dev jackson: # 响应的JSON结果中默认包含什么样的属性 default-property-inclusion: non_null datasource: username: root password: root url: jdbc:mysql://127.0.0.1:3306/jdbc?useSSL=false driver-class-name: com.mysql.jdbc.Driver #自动加载数据表创建sql 默认schema/schema-all schema: - classpath:sql/demo.sql #自动加载数据执行sql文件 默认data/data-all data: - classpath:sql/demo-data.sql #配置数据源类型 type: com.alibaba.druid.pool.DruidDataSource # 数据源其他配置 initialSize: 5 minIdle: 5 maxActive: 20 maxWait: 60000 timeBetweenEvictionRunsMillis: 60000 minEvictableIdleTimeMillis: 300000 validationQuery: SELECT 1 FROM DUAL testWhileIdle: true testOnBorrow: false testOnReturn: false poolPreparedStatements: true # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙 filters: stat,wall,log4j maxPoolPreparedStatementPerConnectionSize: 20 useGlobalDataSourceStat: true connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=500 jpa: hibernate: #数据表生成策略 更新或创建 ddl-auto: update #控制台显示每个执行sql show-sql: true #分布式euerka eureka: instance: prefer-ip-address: true #注册时使用ip进行注册 hostname: eureka-server #注册中心使用 client: register-with-eureka: false #不将自己注册进eureka 注册中心使用 fetch-registry: false #不从eureka上获取注册信息 注册中心使用 service-url: #注册中心地址 defaultZone: http://localhost:8761/eureka/ management: endpoints: web: exposure: include: "*" exclude: env,beans
- 日志类 spring 自带
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-logging</artifactId>
- <version>2.1.8.RELEASE</version>
- <scope>compile</scope>
- </dependency>
- 日志门面+日志实现类
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <version>2.0.0-alpha1</version>
- </dependency>
-
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-log4j2</artifactId>
- </dependency>
-
- thymeleaf配置 html文件默认放置在resources/templete下
- <properties>
- <thymeleaf.version>3.0.2.RELEASE</thymeleaf.version>
- <thymeleaf-layout-dialect.version>2.1.1</thymeleaf-layout-dialect.version>
- </properties>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-thymeleaf</artifactId>
- </dependency>
-
- 表明目标环境已存在 不使用内置tomcat
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-tomcat</artifactId>
- <scope>provided</scope>
- </dependency>
-
- 配置mysql和jdbc
- <dependency>
- <groupId>mysql</groupId>
- <artifactId>mysql-connector-java</artifactId>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-jdbc</artifactId>
- </dependency>
-
- <!--引入安全模块-->
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-security</artifactId>
- </dependency>
- <dependency>
- <groupId>org.thymeleaf.extras</groupId>
- <artifactId>thymeleaf-extras-springsecurity4</artifactId>
- </dependency>
-
- <!--引入email-->
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-mail</artifactId>
- </dependency>
-
- <!--引入elasticsearch 导入jest 二选一-->
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-data-elasticsearch</artifactId>
- </dependency>
-
- <dependency>
- <groupId>io.searchbox</groupId>
- <artifactId>jest</artifactId>
- <version>5.3.3</version>
- <exclusions>
- <exclusion>
- <artifactId>guava</artifactId>
- <groupId>com.google.guava</groupId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <!--引入amqp消息队列-->
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-amqp</artifactId>
- </dependency>
-
- <!--引入redis-->
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-data-redis</artifactId>
- </dependency>
-
- <!--引入cache-->
- <dependency>
- <groupId>javax.cache</groupId>
- <artifactId>cache-api</artifactId>
- </dependency>
-
- <!--引入springdata jpa-->
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-data-jpa</artifactId>
- </dependency>
-
- <!--引入jetty-->
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-jetty</artifactId>
- </dependency>
-
- <!--引入druid数据源-->
- <dependency>
- <groupId>com.alibaba</groupId>
- <artifactId>druid</artifactId>
- <version>1.1.8</version>
- </dependency>
-
- <!--引入mybatis-->
- <dependency>
- <groupId>org.mybatis.spring.boot</groupId>
- <artifactId>mybatis-spring-boot-starter</artifactId>
- <version>1.3.1</version>
- </dependency>
- <!-- MyBatis Plus整合Spring Boot的依赖项 -->
- <dependency>
- <groupId>com.baomidou</groupId>
- <artifactId>mybatis-plus-boot-starter</artifactId>
- <version>3.3.0</version>
- </dependency>
-
- <!--eurek-->
- <dependency>
- <groupId>org.springframework.cloud</groupId>
- <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.cloud</groupId>
- <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
- </dependency>
-
- <!--api接口文档生成-->
- <dependency>
- <groupId>com.github.xiaoymin</groupId>
- <artifactId>knife4j-openapi2-spring-boot-starter</artifactId>
- <version>4.0.0</version>
- </dependency>
-
- <!--数据验证-->
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-validation</artifactId>
- </dependency>
-
- <!--热部署-->
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-tools</artifactId>
- <version>2.2.2.RELEASE</version>
- </dependency>
-
- <!--内嵌式derby数据库-->
- <dependency>
- <groupId>org.apache.derby</groupId>
- <artifactId>derby</artifactId>
- <version>10.14.2.0</version>
- </dependency>
-
- <!-- PageHelper:专用于MyBatis的分页框架 -->
- <dependency>
- <groupId>com.github.pagehelper</groupId>
- <artifactId>pagehelper-spring-boot-starter</artifactId>
- <version>1.3.0</version>
- </dependency>

Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。