官术网_书友最值得收藏!

Debugging

IntelliJ IDEA provides a very powerful but simple to use the debugger that we can use to develop our microservices. If we go back to our ExampleService class, we can click on the gutter in the same line that our getHello method is and we can create a breakpoint, this will be visualized as a red dot on the gutter. Alternatively, we can use the keybinding Ctrl + F8 in Windows, command + F8 on a Mac.

Now, we can go back to the application class, click on the Kotlin icon but choose to debug instead of run. If we request again the URL http://localhost:8080/user/Kotlin, the debugger should stop the application and show our breakpoint.

When the application is stopped, we can see in the middle-bottom side of the screen, the Debugger window:

Debugger window

In this window on the left-hand side, we can see a section named Frames that allows us to navigate through the stack trace to the point where we were stopped.

On the right-hand side, we can see the variables and their value in the current scope of the debugger. Right-clicking on this allows us to define watches that will monitor values using expressions, or inspect objects to see all attributes and methods for existing values.
On the top, near the tabs, we have a vertical bar that contains buttons to navigate through the execution of the debugger, for example, to step in and out of functions calls, or continue running to the current cursor.

We can invoke the debugger from Maven phases and goals, right-click on the Maven Projects Windows to a phase or goal and choose Debug.

主站蜘蛛池模板: 黄山市| 双城市| 贺州市| 浦北县| 沙河市| 泗水县| 苗栗县| 浦东新区| 洛川县| 罗甸县| 彰化县| 泾川县| 怀柔区| 通辽市| 桐乡市| 上蔡县| 红河县| 镇巴县| 永宁县| 贡山| 保定市| 井陉县| 蓝田县| 大荔县| 黄大仙区| 石楼县| 前郭尔| 池州市| 太仆寺旗| 咸阳市| 静安区| 榆社县| 巍山| 万载县| 大厂| 武夷山市| 临猗县| 英山县| 静安区| 邢台县| 嵊泗县|