• Spring boot 环境搭建


    1。pom .xml

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>cn.foen</groupId>
    <artifactId>foen_api</artifactId>
    <packaging>war</packaging>
    <version>0.0.1-SNAPSHOT</version>
    <name>foen_api Maven Webapp</name>
    <!-- https://search.maven.org,http://www.mvnrepository.com/ -->
    <url>http://maven.apache.org</url>

    <!-- Spring Boot 所需依赖 -->
    <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.10.RELEASE</version>
    </parent>

    <!-- 抽取的版本号 -->
    <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.8</java.version>
    </properties>

    <dependencies>

    <!-- Spring Boot 相关启动 -->
    <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <!--热布 -->
    <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-devtools</artifactId>
    <optional>true</optional><!-- optional=true,依赖不会传递,该项目依赖devtools;之后依赖myboot项目的项目如果想要使用devtools,需要重新引入 -->
    <scope>true</scope>
    </dependency>

    <!--使用Jasper引擎解析JSP -->
    <dependency>
    <groupId>org.apache.tomcat.embed</groupId>
    <artifactId>tomcat-embed-jasper</artifactId>
    <scope>provided</scope>
    </dependency>

    <!-- jsp支持 ,servlet依赖 -->
    <dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>javax.servlet-api</artifactId>
    <scope>provided</scope>
    </dependency>
    <dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>jstl</artifactId>
    </dependency>

    <!-- log4j -->
    <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-log4j2</artifactId>
    </dependency>

    <!-- Spring boot 测试 -->
    <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-test</artifactId>
    <scope>test</scope>
    </dependency>

    <!-- spring boot 整合mybaists -->
    <dependency>
    <groupId>org.mybatis.spring.boot</groupId>
    <artifactId>mybatis-spring-boot-starter</artifactId>
    <version>1.3.0</version>
    </dependency>

    <!-- Mysql -->
    <dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <scope>runtime</scope>
    </dependency>

    </dependencies>

    <build>
    <plugins>
    <plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <configuration>
    <fork>true</fork><!-- 如果没有该项配置,devtools不会起作用,即应用不会restart -->
    </configuration>
    </plugin>
    <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>2.3.2</version>
    <configuration>
    <source>1.8</source>
    <target>1.8</target>
    <encoding>UTF-8</encoding>
    </configuration>
    </plugin>
    </plugins>
    <finalName>foen_api</finalName>
    </build>
    </project>

    2.spring boot 几个重要注解

    开启spring boot配置,@EnableAutoConfiguration
    扫描spring booot控制层和service层,@ComponentScan(value= {"com.foen.cloud.controller.*","com.foen.cloud.service.impl"})
    扫描dao接口,@MapperScan(value="com.foen.cloud.mapping")
    启动:,SpringApplication.run(FrontController.class, args);

  • 相关阅读:
    animation关键帧动画语法
    border-image
    CSS3之box-shadow
    border-radius编程练习1-3
    CSS之border-radius
    CSS3之径向渐变
    CSS3之线性渐变(linear gradients)
    CSS之background——背景与渐变练习题
    background-image
    background-color
  • 原文地址:https://www.cnblogs.com/gzhbk/p/9692589.html
Copyright © 2020-2023  润新知