idea中新建springboot项目详解,每一步都有

     当下,微服务的概念特别火,微服务框架简直就是中小企业的福音,他的优点之一就是能够快速搭建,大量减少人力和时间成本。目前最火的两个微服务框架就是springboot和springcloud,下面就总结springboot项目的搭建,springboot的原理就不多说,个人理解这是一种服务器的镜像,就是你可以自己来选择是什么框架的镜像,ssm啊ssh啊,都可以。

    springboot项目的一大优点就是几乎没有配置文件(当然这是他的追求,其实还是要配置一些信息的),下面就来介绍springboot项目的创建步骤:

我用的工具是IDEA:

1、


2、


3、


4、


5、


6、


7、


8、


9、


10、


11、


12、


13、


14、


15、


16、


17、


18、


19、


20、




附上pom.xml里的配置:

<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>

   <groupId>com.tronsis</groupId>
   <artifactId>helloworld</artifactId>
   <version>0.0.1-SNAPSHOT</version>
   <packaging>war</packaging>

   <!-- 项目的名称 -->
   <name>helloworld</name>
   <description>Demo project for Spring Boot</description>

   <!--  -->
   <parent>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-parent</artifactId>
      <version>2.0.0.RELEASE</version>
      <relativePath/><!-- lookup parent from repository -->
   </parent>

   <!-- 配置文件,编码格式和jdk的版本号 -->
   <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>

      <!--  -->
      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-web</artifactId>
         <exclusions>
            <exclusion>
               <groupId>org.springframework.boot</groupId>
               <artifactId>spring-boot-starter-tomcat</artifactId>
            </exclusion>
         </exclusions>
      </dependency>

      <!-- servlet -->
      <dependency>
         <groupId>javax.servlet</groupId>
         <artifactId>javax.servlet-api</artifactId>
         <scope>provided</scope>
      </dependency>

   </dependencies>

   <build>
      <finalName>test</finalName>
      <plugins>
         <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <dependencies>   <!-- 修改代码后自动生效,Reload Java classes without restarting the container -->
               <dependency>
                  <groupId>org.springframework</groupId>
                  <artifactId>springloaded</artifactId>
               </dependency>
            </dependencies>
         </plugin>
      </plugins>
   </build>

   <!-- 设定主仓库,按设定顺序进行查找。 -->
   <repositories>
      <!-- <repository> <id>nexus-repos</id> <name>Team Nexus Repository</name>
            <url>http://123.206.197.44:8081/nexus/content/groups/public</url> </repository> -->
      <repository>
         <id>aliyun-repos</id>
         <name>aliyun Repository</name>
         <url>http://maven.aliyun.com/nexus/content/groups/public</url>
      </repository>
      <repository>
         <id>jeecg</id>
         <name>jeecg Repository</name>
         <url>http://maven.jeecg.org/nexus/content/repositories/jeecg</url>
         <snapshots>
            <enabled>false</enabled>
         </snapshots>
      </repository>
      <repository>
         <id>jeecg-snapshots</id>
         <name>jeecg-snapshots Repository</name>
         <url>http://maven.jeecg.org/nexus/content/repositories/snapshots</url>
         <snapshots>
            <enabled>true</enabled>
         </snapshots>
      </repository>
      <repository>
         <id>java-repos</id>
         <name>Java Repository</name>
         <url>http://download.java.net/maven/2/</url>
      </repository>

      <repository>
         <id>springsource-repos</id>
         <name>SpringSource Repository</name>
         <url>http://repo.spring.io/release/</url>
      </repository>

      <repository>
         <id>central-repos</id>
         <name>Central Repository</name>
         <url>http://repo.maven.apache.org/maven2</url>
      </repository>

      <repository>
         <id>central-repos2</id>
         <name>Central Repository 2</name>
         <url>http://repo1.maven.org/maven2/</url>
      </repository>

      <repository>
         <id>activiti-repos</id>
         <name>Activiti Repository</name>
         <url>https://maven.alfresco.com/nexus/content/groups/public</url>
      </repository>

      <repository>
         <id>activiti-repos2</id>
         <name>Activiti Repository 2</name>
         <url>https://app.camunda.com/nexus/content/groups/public</url>
      </repository>

      <repository>
         <id>spring-milestone</id>
         <url>http://repo.spring.io/libs-release</url>
      </repository>
   </repositories>
   <!-- 设定插件仓库 -->
   <pluginRepositories>
      <!-- 如有Nexus私服, 取消注释并指向正确的服务器地址. -->
      <!-- <pluginRepository> <id>nexus-repos</id> <name>Team Nexus Repository</name>
            <url>http://123.206.197.44:8081/nexus/content/groups/public</url> </pluginRepository> -->
      <pluginRepository>
         <id>aliyun-repos</id>
         <name>aliyun Repository</name>
         <url>http://maven.aliyun.com/nexus/content/groups/public</url>
      </pluginRepository>
   </pluginRepositories>


</project>




























猜你喜欢

转载自blog.csdn.net/qq_35860138/article/details/80852068
今日推荐