SpringBoot:阿里数据源配置、JPA显示sql语句、格式化JPA查询的sql语句

 

1 数据源和JPA配置

  1.1 显示sql配置和格式化sql配置

    者两个配置都是属于hibernate的配置,但是springdatajpa给我们简化了;所有hibernate的配置都在jpa下面的properties中;若果直接配置到jpa下面可能不会生效

eureka:
  client:
    service-url:
      defaultZone: http://localhost:8761/eureka/  # 注册中心
  instance:
    hostname: productClient
spring:
  application:
    name: product

  datasource:
    url: jdbc:mysql://xxxxx:3306/spring_cloud_sell?useUnicode=true&characterEncoding=UTF-8&useSSL=false
#    url: jdbc:mysql://xxxxx:3306/dev?useUnicode=true&characterEncoding=UTF-8&&useSSL=false
#    url: jdbc:mysql://xxxxx:3306/qcbx?useUnicode=true&characterEncoding=UTF-8&&useSSL=false
    driver-class-name: com.mysql.jdbc.Driver
#    username: root
#    password: uAiqwVwjJ8-i
    username: dev
    password: Dev-182838
  jpa:
    properties:
          hibernate:
            format_sql: true
            show_sql: true
View Code

 

 

  

posted @ 2018-07-23 16:21  寻渝记  阅读(1588)  评论(0编辑  收藏  举报