spring boot(1):简介

Spring Boot的优点

  Spring Boot 是伴随着 Spring 4.0 诞生的,从字面理解,Boot是引导的意思,因此 Spring Boot 旨在帮助开发者快速搭建 Spring 框架。Spring Boot 继承了原有 Spring 框架的优秀基因,使 Spring 在使用中更加方便快捷。

嵌入的 Tomcat 、 Jetty 或者 Undertow,无须部署 WAR 文件:

配置Ecplise的Spring Boot开发环境

Unregistering JMX-exposed beans on shutdown

解决办法:去除 <scope>provided</scope>

<dependency>            
<groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> <scope>provided</scope> </dependency>

To display the auto-configuration report re-run your application with 'debug' enabled.

@SpringBootApplication(exclude={DataSourceAutoConfiguration.class,HibernateJpaAutoConfiguration.class})

pom.xml

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-core</artifactId>
    <version>5.0.7.Final</version>
</dependency>

Spring环境配置(安装springsource-tool-suite插件)及第一个Spring HelloWorld 

 [spring boot][thymeleaf]spring boot 1.5+ 页面无法找到

<properties>
        <!--
            springboot 默认使用thymeleaf的2.0,即:spring-boot-starter-thymeleaf中包含的是thymeleaf2.X
            springboot1.5.2+需要使用thymeleaf3.X。手动去配置
        -->
        <thymeleaf.version>3.0.2.RELEASE</thymeleaf.version>
        <thymeleaf-layout-dialect.version>2.0.4</thymeleaf-layout-dialect.version>
    </properties>

 @Controller返回试图   @RestController返回Json

spring boot热部署,pom需要添加以下的配置:

 <dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <optional>true</optional>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
                <fork>true</fork>
            </configuration>
        </plugin>
</plugins>
</build>

Spring Boot 的配置文件及多环境配置

  Profile 是 Spring 用来针对不同的环境对不同的配置提供支持的,全局 Profile 配置使用 application-{profile}. yml(如 application-prod.yml)。

通过在 application.yml 中设置 spring.profiles.active = prod 来指定活动的 Profile。

  依次再目录下面新建三个配置文件,application-dev.yml、application-test.yml、application-prod.yml。它们分别代表开发环境、测试环境、生产环境的配置文件。

项目设计

本项目用到的技术和框架

项目构建: maven

web框架:spring boot

数据库ORM:mybatis

数据库连接池:Druid

分页插件:PageHelper

数据库:mysql

缓存NOSQL:redis

前端模板:thymeleaf

文章展示:使用commonmark,将markdown转成html页面

 资料

http://springboot.fun/

http://spring.io/tools/sts/all

http://blog.csdn.net/q649381130/article/details/77875736

https://www.cnblogs.com/superfj/p/9044532.html

posted @ 2018-03-03 16:17  ~沐风  阅读(250)  评论(0编辑  收藏  举报