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
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
>> 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
@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
--- | |
applications: | |
- name: example-app | |
path: target/example-app-0.0.1-SNAPSHOT.jar | |
memory: 512M | |
random-route: true |
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
package org.thehecklers; | |
import org.springframework.stereotype.Component; | |
import javax.persistence.Entity; | |
import javax.persistence.GeneratedValue; | |
import javax.persistence.GenerationType; | |
import javax.persistence.Id; | |
@Entity |
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
{ | |
"_embedded" : { | |
"readings" : [ { | |
"temperature" : 25.0, | |
"humidity" : 34.0, | |
"_links" : { | |
"self" : { | |
"href" : "http://localhost:8080/readings/1" | |
}, | |
"reading" : { |
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
curl localhost:8080/readings |
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
curl -X POST -H "Content-Type: application/json" -d "{\"temperature\": 26.0, \"humidity\": 35.0}" localhost:8080/readings |
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
package org.thehecklers; | |
import org.springframework.data.repository.CrudRepository; | |
import org.springframework.data.rest.core.annotation.RepositoryRestResource; | |
@RepositoryRestResource | |
public interface ReadingRepository extends CrudRepository<Reading, Long> { | |
} |