Skip to content

Instantly share code, notes, and snippets.

View mkheck's full-sized avatar
💭
Coding, of course!

Mark Heckler mkheck

💭
Coding, of course!
View GitHub Profile
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
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"
>> 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.
@RepositoryRestResource
interface QuoteRepository extends CrudRepository<Quote, Long> {
@Query("select q from Quote q order by RAND()")
public List<Quote> getQuotesRandomOrder();
}
---
applications:
- name: example-app
path: target/example-app-0.0.1-SNAPSHOT.jar
memory: 512M
random-route: true
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
{
"_embedded" : {
"readings" : [ {
"temperature" : 25.0,
"humidity" : 34.0,
"_links" : {
"self" : {
"href" : "http://localhost:8080/readings/1"
},
"reading" : {
curl localhost:8080/readings
curl -X POST -H "Content-Type: application/json" -d "{\"temperature\": 26.0, \"humidity\": 35.0}" localhost:8080/readings
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> {
}