zoukankan      html  css  js  c++  java
  • 在idea上使用springboot构建ssm项目(一)

    springboot

    一、配置Maven

    1、Configure>Settings

    2、Build,Execution,Deployment>Build Tools>Maven>Maven home directory

    二、使用Maven方式构建

    1、点击Create New Project

     2、选择Maven,点击Next

    3、填写域名GroupId和ArtifactId,点击Next

    4、点击Finish

    5、配置pom.xml

        <parent>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>2.0.8.RELEASE</version>
        </parent>
    
        <dependencies>
            <!--引入springmvc web模块-->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
            </dependency>
    
        </dependencies>
    
        <build>
            <plugins>
                <!--加入打包依赖-->
                <!--<plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                </plugin>-->
            </plugins>
        </build>
    

      

    6、Controller

    TestController.java

    package com.zj.controller;
    
    import org.springframework.web.bind.annotation.RestController;
    import org.springframework.web.bind.annotation.RequestMapping;
    
    @RestController
    public class TestController {
    
        @RequestMapping("/hello")
        public String testHello() {
            return "hello";
        }
    }
    

    7、application.properties文件可以改变配置属性

    server.port=8888
    

    8、启动类

    MainClassStart.java文件

    package com.zj;
    
    import org.springframework.boot.SpringApplication;
    import org.springframework.boot.autoconfigure.SpringBootApplication;
    
    @SpringBootApplication
    public class MainClassStart {
        public static void main(String[] args) {
            SpringApplication.run(MainClassStart.class,args);
        }
    }
    

      

    9、使用启动类main方法启动

    10、输入网址

    localhost:8888/hello

    11、pom.xml支持jar

    链接:https://pan.baidu.com/s/1USffaVIrZIr_BxVV93TRTA
    提取码:8888

  • 相关阅读:
    Errors
    fix eclipse gc overhead limit exceeded in mac
    Cobub Razor
    Mac commands
    git vs svn
    SourceTree
    生成静态页技术
    URL重写技术总结
    回味手写三层-增删改查
    生成 (web): 找不到目标 .NET Framework 版本的引用程序集;请确保已安装这些程序集或选择有效的目标版本。
  • 原文地址:https://www.cnblogs.com/zj68/p/13568234.html
Copyright © 2011-2022 走看看