Guest User

Untitled

a guest
Nov 22nd, 2017
50
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.resources;
  2.  
  3. import org.springframework.http.MediaType;
  4. import org.springframework.web.bind.annotation.RequestMapping;
  5. import org.springframework.web.bind.annotation.RequestMethod;
  6. import org.springframework.web.bind.annotation.RestController;
  7.  
  8. @RestController
  9. public class SpringRestController {
  10.  
  11. @RequestMapping(method = { RequestMethod.GET }, value = { "/testApplication" }, consumes = MediaType.ALL_VALUE, produces = MediaType.ALL_VALUE)
  12. public String getServerInfo() {
  13. System.out.println("I got hit");
  14. String message = "Hit the end point";
  15. return message;
  16. }
  17.  
  18. }
  19.  
  20.  
  21.  
  22.  
  23. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  24. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  25. <modelVersion>4.0.0</modelVersion>
  26.  
  27. <groupId>TestRestService</groupId>
  28. <artifactId>TestRestService</artifactId>
  29. <version>0.0.1-SNAPSHOT</version>
  30. <packaging>jar</packaging>
  31.  
  32. <name>TestRestService</name>
  33. <url>http://maven.apache.org</url>
  34.  
  35. <properties>
  36. <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  37. </properties>
  38.  
  39.  
  40. <parent>
  41. <groupId>org.springframework.boot</groupId>
  42. <artifactId>spring-boot-starter-parent</artifactId>
  43. <version>1.5.8.RELEASE</version>
  44. </parent>
  45.  
  46. <dependencies>
  47. <dependency>
  48. <groupId>junit</groupId>
  49. <artifactId>junit</artifactId>
  50. <version>3.8.1</version>
  51. <scope>test</scope>
  52. </dependency>
  53. <!-- https://mvnrepository.com/artifact/javax.ws.rs/javax.ws.rs-api
  54. <dependency>
  55. <groupId>javax.ws.rs</groupId>
  56. <artifactId>javax.ws.rs-api</artifactId>
  57. <version>2.1</version>
  58. </dependency>
  59. -->
  60. <dependency>
  61. <groupId>org.springframework.boot</groupId>
  62. <artifactId>spring-boot-starter-web</artifactId>
  63. </dependency>
  64. <dependency>
  65. <groupId>org.springframework.boot</groupId>
  66. <artifactId>spring-boot-starter-test</artifactId>
  67. <scope>test</scope>
  68. </dependency>
  69. <dependency>
  70. <groupId>com.jayway.jsonpath</groupId>
  71. <artifactId>json-path</artifactId>
  72. <scope>test</scope>
  73. </dependency>
  74. </dependencies>
  75.  
  76.  
  77. <build>
  78. <pluginManagement>
  79. <plugins>
  80. <plugin>
  81. <artifactId>maven-compiler-plugin</artifactId>
  82. <configuration>
  83. <source>1.8</source>
  84. <target>1.8</target>
  85. </configuration>
  86. </plugin>
  87. <!--
  88. <plugin>
  89. <groupId>org.apache.tomcat.maven</groupId>
  90. <artifactId>tomcat6-maven-plugin</artifactId>
  91. <version>2.2</version>
  92. </plugin>
  93. <plugin>
  94. <groupId>org.apache.tomcat.maven</groupId>
  95. <artifactId>tomcat7-maven-plugin</artifactId>
  96. <version>2.2</version>
  97. </plugin>
  98. -->
  99. <plugin>
  100. <groupId>org.springframework.boot</groupId>
  101. <artifactId>spring-boot-maven-plugin</artifactId>
  102. </plugin>
  103. </plugins>
  104. </pluginManagement>
  105. </build>
  106. </project>
  107.  
  108.  
  109.  
  110.  
  111. package com;
  112.  
  113. import org.springframework.boot.SpringApplication;
  114. import org.springframework.boot.autoconfigure.SpringBootApplication;
  115.  
  116. @SpringBootApplication
  117. public class App {
  118. public static void main( String[] args ){
  119. SpringApplication.run(App.class, args);
  120. }
  121. }
RAW Paste Data