This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RepositoryRestResource | |
interface QuoteRepository extends CrudRepository<Quote, Long> { | |
@Query("select q from Quote q order by RAND()") | |
public List<Quote> getQuotesRandomOrder(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RestController | |
class MapFilterController { | |
@GetMapping(value = "/test", headers = "content-type=text/*") | |
public String getTestText() { | |
return "This is a test, using text."; | |
} | |
@GetMapping(value = "/test", headers = "content-type=application/json") | |
public Map<String, String> getTestJson() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>> http :8080/test content-type:text/plain | |
HTTP/1.1 200 | |
Content-Length: 27 | |
Content-Type: text/plain;charset=UTF-8 | |
Date: Thu, 08 Jun 2017 15:46:30 GMT | |
X-Application-Context: application | |
This is a test, using text. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http --json :8080/test | |
HTTP/1.1 200 | |
Content-Type: application/json;charset=UTF-8 | |
Date: Thu, 08 Jun 2017 15:47:22 GMT | |
Transfer-Encoding: chunked | |
X-Application-Context: application | |
{ | |
"testKey": "testValue" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<dependency> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-starter-actuator</artifactId> | |
</dependency> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<build> | |
<plugins> | |
<plugin> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-maven-plugin</artifactId> | |
<executions> | |
<execution> | |
<goals> | |
<goal>build-info</goal> | |
</goals> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
humbert :: ~ » http :8080 | |
HTTP/1.1 200 | |
Content-Type: application/json;charset=UTF-8 | |
Date: Wed, 21 Jun 2017 07:42:27 GMT | |
Transfer-Encoding: chunked | |
{ | |
"myKey": "myValue" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
humbert :: ~ » http :8080 'Accept:application/xml' | |
HTTP/1.1 200 | |
Content-Type: application/xml;charset=UTF-8 | |
Date: Wed, 21 Jun 2017 07:42:36 GMT | |
Transfer-Encoding: chunked | |
<Map><myKey>myValue</myKey></Map> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<dependency> | |
<groupId>com.fasterxml.jackson.dataformat</groupId> | |
<artifactId>jackson-dataformat-xml</artifactId> | |
</dependency> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<dependencies> | |
<dependency> | |
<groupId>org.springframework.cloud</groupId> | |
<artifactId>spring-cloud-starter-sleuth</artifactId> | |
</dependency> | |
<dependency> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-starter-web</artifactId> | |
</dependency> | |
<dependency> |