validate 加载hibernate时,验证创建数据库表结构
create 每次加载hibernate,重新创建数据库表结构
create-drop 加载hibernate时创建,退出是删除表结构
update 加载hibernate自动更新数据库结构
配置文件里注释掉即可
<!--打印SQL语句及参数--> <!-- <logger name="org.hibernate.type.descriptor.sql.BasicBinder" level="TRACE" />--> <!-- <logger name="java.sql.Connection" level="DEBUG" />--> <!-- <logger name="java.sql.Statement" level="DEBUG" />--> <!-- <logger name="java.sql.PreparedStatement" level="DEBUG" />-->
这个是jpa 打印sql 值 和参数的, 要对应上面的show-sql 为true
===========================================
@PostConstruct我一般使用来 测试定时任务的 时候启用
@PostConstruct该注解被用来修饰一个非静态的void()方法。被@PostConstruct修饰的方法会在服务器加载Servlet的时候运行: bean创建完成空对象,就开始进行@Autowire、@PostConstruct赋值
<configuration scan="true" scanPeriod="10 seconds"> <include resource="org/springframework/boot/logging/logback/base.xml" /> <!--服务器日志存储路径--> <property name="LOG_PATH" value="../log/xxx-front" /> <!--info级别的日志--> <appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> <File>${LOG_PATH}/info.log</File> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <fileNamePattern>${LOG_PATH}/info-%d{yyyyMMdd}.log.%i</fileNamePattern> <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> <maxFileSize>5120MB</maxFileSize> </timeBasedFileNamingAndTriggeringPolicy> <maxHistory>30</maxHistory> </rollingPolicy> <layout class="ch.qos.logback.classic.PatternLayout"> <Pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} -%msg%n </Pattern> </layout> </appender> <!--error级别的日志--> <appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> <level>ERROR</level> </filter> <File>${LOG_PATH}/error.log</File> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <fileNamePattern>${LOG_PATH}/error-%d{yyyyMMdd}.log.%i </fileNamePattern> <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> <maxFileSize>5120MB</maxFileSize> </timeBasedFileNamingAndTriggeringPolicy> <maxHistory>90</maxHistory> </rollingPolicy> <layout class="ch.qos.logback.classic.PatternLayout"> <Pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} -%msg%n </Pattern> </layout> </appender> <root level="INFO"> <appender-ref ref="CONSOLE" /> <appender-ref ref="INFO_FILE" /> </root> <!--打印SQL语句及参数--> <!-- <logger name="org.hibernate.type.descriptor.sql.BasicBinder" level="TRACE" />--> <!-- <logger name="java.sql.Connection" level="DEBUG" />--> <!-- <logger name="java.sql.Statement" level="DEBUG" />--> <!-- <logger name="java.sql.PreparedStatement" level="DEBUG" />--> </configuration>