Spingboot 在idea下开启断点调试 | 您所在的位置:网站首页 › jar包断点进不去 › Spingboot 在idea下开启断点调试 |
学习springboot 开发web 应用,大家都是idea好用也试着用用,运行起来之后,想要调试,但是总不行,试了好久才搞好,必须要记下来: 用 Spring Initializr 构建的项目。 HelloWorldController.java: package com.example.demo.controller; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; @RestController public class HelloWorldController { @RequestMapping("/hello") public String hello() { return "Hello World"; } @RequestMapping("/index") @ResponseBody public String index(HttpServletRequest req, HttpServletResponse resp) { resp.addHeader("Access-Control-Allow-Origin", "*");//在这里打断点,启动后小红点会被打上个小勾 return "{'a':3333333399}"; } }pom.xml : 4.0.0 org.springframework.boot spring-boot-starter-parent 2.1.4.RELEASE com.example demo 0.0.1-SNAPSHOT demo Demo project for Spring Boot 1.8 org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-tomcat provided org.springframework.boot spring-boot-starter-test test org.springframework.boot spring-boot-devtools true org.springframework.boot spring-boot-maven-plugin false重点来了: pom中: org.springframework.boot spring-boot-maven-plugin false |
CopyRight 2018-2019 实验室设备网 版权所有 |