SpringBoot+Idea:工具栏Application Servers 消失

idea的Application Servers突然消失,操作了一波后,发现是突然非正常关闭的原因。

解决措施:

1.file-----settings

2.选择左侧工具栏的Plugins

3.在右侧可以看到Application Servers View   勾选重启即可

SpringBoot:Spring Boot是由Pivotal团队提供的全新框架,其设计目的是用来简化新Spring应用的初始搭建以及开发过程。该框架使用了特定的方式来进行配置,从而使开发人员不再需要定义样板化的配置。通过这种方式,Spring Boot致力于在蓬勃发展的快速应用开发领域(rapid application development)成为领导者。

快速搭建:

1.在工作空间上,右击  new module

2. 选择Spring Initializr

3. 默认  default  https://start.spring.io/  下载模块

4.Artifact  只能小写

  Packaging  -------jar

next

5.在新建的SpringBoot

不能在src/main/java下创建

在com.xx.xm下建包

package com.hc.springboothc.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class FirstController {

    @RequestMapping("first")
    @ResponseBody
    public String First(){

        return "yes";
    }

}
application.properties:配置文件


在com.xx.xm下的xmApplication,里面有main方法,点击绿色三角,启动。
server.port=10010
server.servlet.context-path=/aaa

 server.port=10010:更改端口号

Spring内置tomcat配置,直接在Application的main里启动,

不需要将项目配置到Tomcat之后,再启动

server.servlet.context-path=/aaa:上下文路径

相当于项目名,等于多了一级路径

SpringBoot里不建议使用Jsp,而是用模板渲染 

猜你喜欢

转载自blog.csdn.net/qq_43532342/article/details/84203513
今日推荐