SpringBooot-基础<2>-POM.xml配置
项目创建完成后,需要配置pom.xml文件。
pom.xml里面的配置,按需进行添加,这里提供一份参考,后面做笔记会都用到。
1 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 2 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 3 <modelVersion>4.0.0</modelVersion> 4 <groupId>com.gongziyuan</groupId> 5 <artifactId>core-users</artifactId> 6 <version>0.0.1-SNAPSHOT</version> 7 8 <parent> 9 <groupId>org.springframework.boot</groupId> 10 <artifactId>spring-boot-starter-parent</artifactId> 11 <version>1.5.8.RELEASE</version> 12 <relativePath /> 13 </parent> 14 15 <properties> 16 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 17 <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> 18 <java.version>1.8</java.version> 19 </properties> 20 21 <dependencies> 22 <!-- SPRING BOOT WEB --> 23 <dependency> 24 <groupId>org.springframework.boot</groupId> 25 <artifactId>spring-boot-starter-web</artifactId> 26 </dependency> 27 28 <!-- SPRING BOOT AOP --> 29 <dependency> 30 <groupId>org.springframework.boot</groupId> 31 <artifactId>spring-boot-starter-aop</artifactId> 32 </dependency> 33 34 <!-- FREEMARKER框架 --> 35 <dependency> 36 <groupId>org.springframework.boot</groupId> 37 <artifactId>spring-boot-starter-freemarker</artifactId> 38 </dependency> 39 40 <!-- 数据库 --> 41 <dependency> 42 <groupId>org.mybatis.spring.boot</groupId> 43 <artifactId>mybatis-spring-boot-starter</artifactId> 44 <version>1.3.2</version> 45 </dependency> 46 47 <dependency> 48 <groupId>mysql</groupId> 49 <artifactId>mysql-connector-java</artifactId> 50 <scope>runtime</scope> 51 </dependency> 52 53 <dependency> 54 <groupId>com.alibaba</groupId> 55 <artifactId>druid</artifactId> 56 <version>1.0.5</version> 57 </dependency> 58 59 <!-- Swagger --> 60 <dependency> 61 <groupId>io.springfox</groupId> 62 <artifactId>springfox-swagger2</artifactId> 63 <version>2.7.0</version> 64 </dependency> 65 <dependency> 66 <groupId>io.springfox</groupId> 67 <artifactId>springfox-swagger-ui</artifactId> 68 <version>2.7.0</version> 69 </dependency> 70 71 <!-- page分页 --> 72 <dependency> 73 <groupId>com.github.pagehelper</groupId> 74 <artifactId>pagehelper-spring-boot-starter</artifactId> 75 <version>1.2.3</version> 76 </dependency> 77 78 <dependency> 79 <groupId>com.alibaba</groupId> 80 <artifactId>fastjson</artifactId> 81 <version>1.2.58</version> 82 </dependency> 83 <dependency> 84 <groupId>org.apache.commons</groupId> 85 <artifactId>commons-lang3</artifactId> 86 <version>3.8</version> 87 </dependency> 88 89 <dependency> 90 <groupId>org.springframework.boot</groupId> 91 <artifactId>spring-boot-devtools</artifactId> 92 </dependency> 93 94 <dependency> 95 <groupId>org.springframework.boot</groupId> 96 <artifactId>spring-boot-configuration-processor</artifactId> 97 <optional>true</optional> 98 </dependency> 99 </dependencies> 100 101 </project>
新见的工程pom.xml里面添加上述文件后,会有红点报错。如下:
解决方法:
更新一下项目即可:
选中项目,鼠标右键:maven -> Update Project... -> 点击ok
选择需要更新的项目,然后点击ok
更新后,红点报错消失: