分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow
也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!
application.properties 文件和 application.yml 文件有什么区别呢?
yml文件的好处,天然的树状结构,一目了然,实质上跟properties是差不多的。
官方给的很多demo,都是用yml文件配置的。
注意点:
1,原有的key,例如spring.jpa.properties.hibernate.dialect,按“.”分割,都变成树状的配置
2,key后面的冒号,后面一定要跟一个空格
3,把原有的application.properties删掉。然后一定要执行一下 maven -X clean install
示例:
#application.ymlserver: port: 8086 spring: datasource: name: test url: jdbc:mysql://192.168.1.112:3306/test username: root password: xxx # 使用druid数据源 type: com.alibaba.druid.pool.DruidDataSource driver-class-name: com.mysql.jdbc.Driver filters: stat maxActive: 20 initialSize: 1 maxWait: 60000 minIdle: 1 timeBetweenEvictionRunsMillis: 60000 minEvictableIdleTimeMillis: 300000 validationQuery: select 'x' testWhileIdle: true testOnBorrow: false testOnReturn: false poolPreparedStatements: true maxOpenPreparedStatements: 20
#application.propertiesserver.port=8085spring.datasource.type=org.apache.tomcat.jdbc.pool.DataSourcespring.datasource.url=jdbc:mysql://aliyuncs.com:3306/home?useUnicode=true&zeroDateTimeBehavior=convertToNull&autoReconnect=truespring.datasource.username=rootspring.datasource.password=***spring.datasource.driver-class-name=com.mysql.jdbc.Driver#mybatis.mapper-locations=classpath*:com/wanyu/fams/mapping/*Mapper.xml#mybatis.type-aliases-package=com.wanyu.fams.modelspring.mvc.view.prefix=/WEB-INF/jsp/spring.mvc.view.suffix=.jspspring.druid.datasource.type=com.alibaba.druid.pool.DruidDataSourcespring.druid.datasource.driverClassName=com.mysql.jdbc.Driverspring.druid.datasource.url=jdbc:mysql://localhost:3306/spring_boot?characterEncoding=utf-8spring.druid.datasource.username=rootspring.druid.datasource.password=xxx
你可能还会关注:
Spring Boot application.yml application.properties 优先级
给我老师的人工智能教程打call!http://blog.csdn.net/jiangjunshow
![这里写图片描述](https://i-blog.csdnimg.cn/blog_migrate/2e19ffb3303a490d20ea5d00dd397156.gif)