Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
sample springboot application
//$ cat
package hello;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.boot.context.embedded.LocalServerPort;
public class Application {
@RequestMapping("/" )
public String home() {
return "<h3>Name: Demo App<br />Version: 1<br />IPAddress: " + getHostAddress();
private InetAddress getHostAddress() {
try {
return InetAddress.getLocalHost();
} catch (UnknownHostException ex) {
throw new IllegalArgumentException(ex.getMessage(), ex);
public static void main(String[] args) {, args);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment