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);
Spring boot 环境搭建
原创wx6311aa5a3b012 博主文章分类:spring boot ©著作权
文章标签 spring maven java 文章分类 spring boot 后端开发
©著作权归作者所有:来自51CTO博客作者wx6311aa5a3b012的原创作品,请联系作者获取转载授权,否则将追究法律责任
上一篇:spring boot 参数传递(spring boot 参数传数 arg0 每一个参数 arg0#{arg0},arg1 #{arg1})
下一篇:spring security中@PreAuthorize、@PostAuthorize、@PreFilter和@PostFilter四者的区别
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
Spring Cloud 入门到进阶 - 01 搭建Eureka服务环境
Spring Cloud 入门到进阶 - 01 搭建Eureka服务环境
spring spring cloud 微服务 eureka 注册中心 -
spring boot的环境搭建
spring boot 入门
spring boot 入门