Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize Spring Boot2 remote debugging

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces "how to achieve Spring Boot2 remote debugging". In daily operation, I believe many people have doubts about how to achieve Spring Boot2 remote debugging. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "how to achieve Spring Boot2 remote debugging". Next, please follow the editor to study!

Support for remote debugging

Spring Boot developers are not limited to local development. Development and joint debugging testing can also be done remotely. To enable it, you need to add the following plug-in, the code is as follows:

one

two

3 org.springframework.boot

4 spring-boot-maven-plugin

five

6 false

seven

eight

nine

Then you need to set the remote access password as follows:

1spring.devtools.remote.secret=mysecret

Enabling spring-boot-devtools on remote applications is a security risk. Therefore, enabling support on production deployments is not recommended.

Client

Spring Boot development remote debugging is divided into server side and client side. The server automatically enables it when the spring.devtools.remote.secret property is set.

The client needs to be enabled manually. In the client's IDE, the same directory as the remote classpath runs org.springframework.boot.devtools.RemoteSpringApplication, and the required parameter is the URL to which the remote is connected.

If you are using Eclipse or STS, you can refer to the following steps:

Create a new project myclient and deploy it to the remote server after completion.

Select run- > run configuration.

Create a new Java Application.

Select the myclient project.

The main class uses org.springframework.boot.devtools.RemoteSpringApplication.

Then add the address of the deployed application in Program arguments.

Just run and start.

After the startup is complete, you can see the following prompt:

1o.s.b.devtools.RemoteSpringApplication: Started RemoteSpringApplication in 0.74 seconds (JVM running for 1.105)

Because the client uses the same classpath as the real application, it can read the application properties directly. Identity is authenticated through spring.devtools.remote.secret.

Https is recommended because it ensures security.

If you use a proxy, you need to configure the spring.devtools.remote.proxy.host and spring.devtools.remote.proxy.port properties.

Remote update

Any changes made by the client are pushed to the remote end and a restart is triggered. This approach can be very helpful if existing applications do not have the functional iterations of cloud services. In general, remote updates and restarts are much faster than full rebuild and deployment cycles.

Note:

Changes to the contents of the file will take effect only when remote debugging is started, and changes made when not connected will not be synchronized to the remote end.

At this point, the study on "how to achieve Spring Boot2 remote debugging" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report