spring boot 学习笔记(009)

时间:2024-10-30 11:27:20

现在我们的文件内容是:


=8090
-timeout=30
-path=
-threads=0
-encoding=UTF-8

 = jdbc:mysql://localhost:3306/newbirds
 = root
 = mymysql
 = 
# Specify the DBMS
 = MYSQL
# Show or not log for each sql query
-sql = true
# Hibernate ddl auto (create, create-drop, update)
-auto = update
# Naming strategy
-strategy = 

# stripped before adding them to the entity manager)
 = .MySQL5Dialect

而官方给的很多demo,都是用yml文件配置的。

yml文件的好处,天然的树状结构,一目了然。不过当时把 改成 还是痛苦了一会儿。

下面是置换后的内容:

server:
  port: 8090
  session-timeout: 30
  -threads: 0
  -encoding: UTF-8

spring:
  datasource:
    url : jdbc:mysql://localhost:3306/newbirds
    username : root
    password : mymysql
    driverClassName : 
  jpa:
    database : MYSQL
    show-sql : true
    hibernate:
      ddl-auto : update
      naming-strategy : 
    properties:
      hibernate:
        dialect : .MySQL5Dialect

注意点:

1,原有的key,例如,按“.”分割,都变成树状的配置

2,key后面的冒号,后面一定要跟一个空格

3,把原有的删掉。然后一定要执行一下  maven -X clean install