BAEL-1128: A Practical Guide to Java Remote Debugging (#3144)

This commit is contained in:
Sergey Petunin 2017-12-08 14:01:23 +01:00 committed by Grzegorz Piwowarek
parent 2ed8da65c1
commit f5a5c02053
5 changed files with 105 additions and 0 deletions

View File

@ -0,0 +1,16 @@
## Building
To build the module, use Maven's `package` goal:
```
mvn clean package
```
The `war` file will be available at `target/remote-debugging.war`
## Running
The `war` application is deployed to Apache Tomcat 8 or any other Java Web or Application server.
To deploy it to the Apache Tomcat 8 server, drop it in the `tomcat/webapps` directory.
The service then will be accessible at http://localhost:8080/remote-debugging/hello?name=John

View File

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.stackify</groupId>
<artifactId>java-remote-debugging</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.8.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>remote-debugging</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,12 @@
package com.stackify.debug;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class JavaRemoteDebuggingApplication {
public static void main(String[] args) {
SpringApplication.run(JavaRemoteDebuggingApplication.class, args);
}
}

View File

@ -0,0 +1,12 @@
package com.stackify.debug.config;
import com.stackify.debug.JavaRemoteDebuggingApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
public class WebInitializer extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(JavaRemoteDebuggingApplication.class);
}
}

View File

@ -0,0 +1,16 @@
package com.stackify.debug.rest;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController("/hello")
public class HelloController {
@GetMapping
public String hello(@RequestParam("name") String name) {
String message = "Hello, " + name;
return message;
}
}