注意代码中的两个点: 1. 注解注释该类是个 spring-boot 项目的启动类 2. 通过调用 SpringApplication 的静态方法,传递该类的 class 实例进行启动。 可以直接通过 ide 启动该类,日志输出以下即表示启动成功:
1 2
2018-08-22 10:14:51.515 INFO 1789 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http) 2018-08-22 10:14:51.520 INFO 1789 --- [ main] cn.liweidan.web.WebApplication : Started WebApplication in 2.492 seconds (JVM running for 3.673)
# 日志配置相关 logging.config= # 日志配置文件的路径. For instance, `classpath:logback.xml` for Logback. logging.file= # Log file name (for instance, `myapp.log`). Names can be an exact location or relative to the current directory. logging.file.max-history=0 # 日志保留最大的数量,只支持logback logging.file.max-size=10MB # 日志最大容量 logging.level.*= # 指定文件的日志等级. For instance, `logging.level.org.springframework=DEBUG`. logging.path= # 日志存放的文件夹路径. For instance, `/var/log`. logging.pattern.console= # Appender pattern for output to the console. Supported only with the default Logback setup. logging.pattern.dateformat=yyyy-MM-dd HH:mm:ss.SSS # Appender pattern for log date format. Supported only with the default Logback setup. logging.pattern.file= # Appender pattern for output to a file. Supported only with the default Logback setup. logging.pattern.level=%5p # Appender pattern for log level. Supported only with the default Logback setup. logging.register-shutdown-hook=false # Register a shutdown hook for the logging system when it is initialized.
# Email (MailProperties) spring.mail.default-encoding=UTF-8 # Default MimeMessage encoding. spring.mail.host= # SMTP server host. For instance, `smtp.example.com`. spring.mail.password= # Login password of the SMTP server. spring.mail.port= # SMTP server port. spring.mail.properties.*= # Additional JavaMail Session properties. spring.mail.protocol=smtp # Protocol used by the SMTP server. spring.mail.test-connection=false # Whether to test that the mail server is available on startup. spring.mail.username= # Login user of the SMTP server.
# 线程池配置 (TaskExecutionProperties) spring.task.execution.pool.allow-core-thread-timeout=true # Whether core threads are allowed to time out. This enables dynamic growing and shrinking of the pool. spring.task.execution.pool.core-size=8 # Core number of threads. spring.task.execution.pool.keep-alive=60s # Time limit for which threads may remain idle before being terminated. spring.task.execution.pool.max-size= # Maximum allowed number of threads. If tasks are filling up the queue, the pool can expand up to that size to accommodate the load. Ignored if the queue is unbounded. spring.task.execution.pool.queue-capacity= # Queue capacity. An unbounded capacity does not increase the pool and therefore ignores the "max-size" property. spring.task.execution.thread-name-prefix=task- # Prefix to use for the names of newly created threads.
# WEB CONFIG server.port=8080 # 端口
# DATASOURCE (DataSourceAutoConfiguration & DataSourceProperties) spring.datasource.continue-on-error=false # 初始化数据库连接池的时候,出现异常是否继续初始化 spring.datasource.data= # Data (DML) script resource references. 数据库数据初识文件 spring.datasource.driver-class-name= # 驱动名称 spring.datasource.generate-unique-name=false # 是否随机生成一个数据库名称 spring.datasource.hikari.*= # Hikari specific settings spring.datasource.initialization-mode=embedded # Initialize the datasource with available DDL and DML scripts. spring.datasource.name= # Name of the datasource. Default to "testdb" when using an embedded database. spring.datasource.password= # 登陆数据库密码 spring.datasource.schema= # 表结构文件 spring.datasource.type= # 修改连接池驱动 spring.datasource.username= # 登陆数据库用户名
# JPA (JpaBaseConfiguration, HibernateJpaAutoConfiguration) spring.jpa.generate-ddl=false # 初始化的时候是否创建数据表 spring.jpa.hibernate.ddl-auto= # DDL 模式,跟hibernate的一致. This is actually a shortcut for the "hibernate.hbm2ddl.auto" property. Defaults to "create-drop" when using an embedded database and no schema manager was detected. Otherwise, defaults to "none". spring.jpa.show-sql=false # 是否在日志打印sql语句