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

  • 相关阅读:
    23 数字时钟&长图滚动
    22 日期特效&长图滚动
    彻底澄清c/c++指针概念
    已管理员模式运行批处理路径丢失问题的解决方法
    使用mathjax在博客中完美显示数学公式,支持PC,手机浏览器
    GOOGLE高级搜索技巧
    我要搬家
    简单的3proxy配置
    AutoMapper小结
    专业IT培训机构-传智播客
  • 原文地址:https://www.cnblogs.com/zj68/p/13568234.html
Copyright © 2011-2022 走看看