首先File ->New -> project ->Spring Initializr ->next

如果没有Spring Initializr   选择右下角config ->setting  搜索Springboot 勾选  然后apply ok

 

第二步:

在项目中写上自己需要的名称 type 选择 maven project ->next

 

第三步:

 

 选择sql

 

nosql 然后一路next  finsh 结束

 

 pom.xml

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  4. <modelVersion>4.0.0</modelVersion>
  5.  
  6. <groupId>com.cedar.star</groupId>
  7. <artifactId>demo</artifactId>
  8. <version>0.0.1-SNAPSHOT</version>
  9. <packaging>jar</packaging>
  10.  
  11. <name>scm</name>
  12. <description>scm project for Spring Boot</description>
  13.  
  14. <parent>
  15. <groupId>org.springframework.boot</groupId>
  16. <artifactId>spring-boot-starter-parent</artifactId>
  17. <version>2.0.4.RELEASE</version>
  18. <relativePath/> <!-- lookup parent from repository -->
  19. </parent>
  20.  
  21. <properties>
  22. <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  23. <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
  24. <java.version>1.8</java.version>
  25. </properties>
  26.  
  27. <dependencies>
  28. <dependency>
  29. <groupId>org.springframework.boot</groupId>
  30. <artifactId>spring-boot-starter-amqp</artifactId>
  31. </dependency>
  32. <dependency>
  33. <groupId>org.springframework.boot</groupId>
  34. <artifactId>spring-boot-starter-batch</artifactId>
  35. </dependency>
  36. <dependency>
  37. <groupId>org.springframework.boot</groupId>
  38. <artifactId>spring-boot-starter-data-jpa</artifactId>
  39. </dependency>
  40. <dependency>
  41. <groupId>org.springframework.boot</groupId>
  42. <artifactId>spring-boot-starter-data-redis</artifactId>
  43. </dependency>
  44. <dependency>
  45. <groupId>org.springframework.boot</groupId>
  46. <artifactId>spring-boot-starter-jdbc</artifactId>
  47. </dependency>
  48. <dependency>
  49. <groupId>org.springframework.boot</groupId>
  50. <artifactId>spring-boot-starter-mail</artifactId>
  51. </dependency>
  52. <dependency>
  53. <groupId>org.springframework.boot</groupId>
  54. <artifactId>spring-boot-starter-quartz</artifactId>
  55. </dependency>
  56. <dependency>
  57. <groupId>org.springframework.boot</groupId>
  58. <artifactId>spring-boot-starter-web</artifactId>
  59. </dependency>
  60. <dependency>
  61. <groupId>org.mybatis.spring.boot</groupId>
  62. <artifactId>mybatis-spring-boot-starter</artifactId>
  63. <version>1.3.2</version>
  64. </dependency>
  65.  
  66. <dependency>
  67. <groupId>mysql</groupId>
  68. <artifactId>mysql-connector-java</artifactId>
  69. <scope>runtime</scope>
  70. </dependency>
  71. <dependency>
  72. <groupId>org.springframework.boot</groupId>
  73. <artifactId>spring-boot-starter-test</artifactId>
  74. <scope>test</scope>
  75. </dependency>
  76. <dependency>
  77. <groupId>org.springframework.batch</groupId>
  78. <artifactId>spring-batch-test</artifactId>
  79. <scope>test</scope>
  80. </dependency>
  81. </dependencies>
  82.  
  83. <build>
  84. <plugins>
  85. <plugin>
  86. <groupId>org.springframework.boot</groupId>
  87. <artifactId>spring-boot-maven-plugin</artifactId>
  88. </plugin>
  89. </plugins>
  90. </build>
  91.  
  92.  
  93. </project>

 

 写一个测试demo 看看效果:

配置端口:

 

  1. package com.cedar.demo;
  2.  
  3. import org.springframework.boot.SpringApplication;
  4. import org.springframework.boot.autoconfigure.SpringBootApplication;
  5. import org.springframework.web.bind.annotation.RequestMapping;
  6. import org.springframework.web.bind.annotation.RestController;
  7.  
  8. @RestController
  9. @SpringBootApplication
  10. public class index {
  11.  
  12. @RequestMapping("/")
  13. String index() {
  14. return "Hello Spring Boot";
  15. }
  16. public static void main(String[] args) {
  17. SpringApplication.run(index.class, args);
  18. }
  19. }

  

启动项目

结果:

 

版权声明:本文为xiaosisong原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/xiaosisong/p/9507041.html