zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    盛最多水的容器
    除自身以外数组的乘积
    组合总和
    旋转图像
    找到所有数组中消失的数字
    RSA加密、签名机制
    SpringBoot-从新建一个项目看起
    linux下vi命令修改文件及保存的使用方法
    集合
    第一个注解式的SpringMVC项目
  • 原文地址:https://www.cnblogs.com/cnki/p/8496991.html
Copyright © 2011-2022 走看看