zoukankan      html  css  js  c++  java
  • Spring Boot TIPS

    一、Aliyun Java Initializr

      https://start.aliyun.com/

    二、Spring JPA 开启原生SQL打印

    application.properties

    spring.jpa.properties.hibernate.show_sql=true          //控制台是否打印
    spring.jpa.properties.hibernate.format_sql=true        //格式化sql语句
    spring.jpa.properties.hibernate.use_sql_comments=true  //指出是什么操作生成了该语句
    spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL55Dialect // 使用MySQL5.5版本方言,否则默认为MyISAM引擎

    logback.xml

    ​​​​​​​<logger name="org.hibernate.SQL" level="DEBUG"/>
    <logger name="org.hibernate.engine.QueryParameters" level="DEBUG"/>
    <logger name="org.hibernate.engine.query.HQLQueryPlan" level="DEBUG"/>

    引用资料:

    https://my.oschina.net/haitaohu/blog/2994254
    https://www.baeldung.com/sql-logging-spring-boot

    三、spring.jpa.hibernate.ddl-auto设置

    create – Hibernate first drops existing tables, then creates new tables
    update – the object model created based on the mappings (annotations or XML) is compared with the existing schema, and then Hibernate updates the schema according to the diff. It never deletes the existing tables or columns even if they are no more required by the application
    create-drop – similar to create, with the addition that Hibernate will drop the database after all operations are completed. Typically used for unit testing
    validate – Hibernate only validates whether the tables and columns exist, otherwise it throws an exception
    none – this value effectively turns off the DDL generation

    引用资料:https://www.baeldung.com/spring-boot-data-sql-and-schema-sql

    四、全局分页设置

    spring.data.web.pageable.size-parameter=size
    spring.data.web.pageable.page-parameter=page
    spring.data.web.pageable.default-page-size=20
    spring.data.web.pageable.one-indexed-parameters=false
    spring.data.web.pageable.max-page-size=2000
    spring.data.web.pageable.prefix=
    spring.data.web.pageable.qualifier-delimiter=_

    他们分别表示如下意思:

    • with size-parameter we can change the name of the size query parameter
    • with page-parameter we can change the name of the page query parameter
    • with default-page-size we can define the default of the size parameter if no value is given
    • with one-indexed-parameters we can choose if the page parameter starts with 0 or with 1
    • with max-page-size we can choose the maximum value allowed for the size query parameter (values larger than this will be reduced)
    • with prefix we can define a prefix for the page and size query parameter names (not for the sort parameter!)

    参考链接:https://reflectoring.io/spring-boot-paging/

    五、

  • 相关阅读:
    转:无线AP模式之无线AP Client客户端模式的应用体验(一)
    Bridge mode
    无线组网(六)——11n无线路由器WDS功能应用举例
    NETGEAR无线路由器WDS功能介绍
    Memory Access vs CPU Speed_你真的了解CPU和内存吗?
    Readyboost功能
    分析:新技术解决服务器内三大I/O瓶颈
    TPLINK Mini系列无线路由器设置指南(三)——Repeater模式
    smartbit网络性能测试介绍
    低端路由器和高端路由的区别
  • 原文地址:https://www.cnblogs.com/echo1937/p/13068867.html
Copyright © 2011-2022 走看看