Giter VIP home page Giter VIP logo

gs-accessing-data-rest's People

Contributors

avivmu avatar bagnier avatar boykoalex avatar buzzardo avatar gregturn avatar javalisson avatar martinlippert avatar mp911de avatar pgilad avatar sdeleuze avatar someguy590 avatar spring-operator avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gs-accessing-data-rest's Issues

How did you set the URL prefix to ""? By default it is "/data/" when I try it.

Sorry to complain but I wasted 2 days trying to figure out why I was only getting 404 from my tests with MockMvc and in-container. I set up my project with the defaults, I hardly changed anything, yet the URL to the webservices is prefixed with '/data/'. It would have saved a lot of frustration if you'd mentioned it.

How to define mappings and exclusions (Entity->Rest)?

Hello,
I wonder how to define rules (ideally of a desclarative kind) to change what is exposed by the rest API.
Example:
Entity: id:0, name:John, surname: Doe
should be exposed via Rest-API (by ommitting the DB ID and concatenating name and surname) as
Rest: userName: "John Doe"

Is there a lightweight declarative way to define such mapping and exclusion rules (for example in the entity)?
Would be nice if you could provide a brief simple example / link. :)

Is @RepositoryRestResource actually not required for a repository to be exported?

I followed the tutorial without issue and then I tried to mess with things a bit.

In the "Create a Person Repository" section a note states: "@RepositoryRestResource is not required for a repository to be exported. It is used only to change the export details, such as using /people instead of the default value of /persons."

So, I tried to remove the @RepositoryRestResource and checked if the person resources were still available in the service; clearly they weren't.

So either either I don't understand the meaning of "exporting a repository" or the @RepositoryRestResource is actually necessary for Spring Data REST to do its magic.

cURL POST command does not work on Windows Command Prompt because single quotes are used

Windows Command Prompt treats quotes differently when compared to the Unix shell and this causes an error when the developer tries to create a new person using cURL to post data.

> curl -X POST -d '{"firstName": "Bilbo", "lastName": "Baggins"}' -H 'Content-Type:application/json' localhost:8080/people
curl: (6) Could not resolve host: Bilbo,
curl: (6) Could not resolve host: lastName
curl: (3) [globbing] unmatched close brace/bracket in column 8
{"cause":null,"message":"No suitable HttpMessageConverter found to read request body into object of type class hello.Person from request with content type of application/x-www-form-urlencoded;charset=UTF-8!"}

The solution is to change the single quotes to double quotes and escape properly que double quotes inside the data:

> curl -X POST -d "{\"firstName\": \"Bilbo\", \"lastName\": \"Baggins\"}" -H "Content-Type:application/json" localhost:8080/people
{
  "firstName" : "Bilbo",
  "lastName" : "Baggins",
  "_links" : {
    "self" : {
      "href" : "http://localhost:8080/people/1"
    },
    "person" : {
      "href" : "http://localhost:8080/people/1"
    }
  }
}

The previous command works on Windows and also on the Unix shell. Also that's the way it's described in the cURL manual:

If you want the parameter to contain spaces, you must enclose the entire
parameter within double quotes ("). Within those quotes, you specify a
quote as ".

This is not a huge problem and also makes the command a little harder to read and to write, but it made review all my code from the tutorial many times, since I thought I was leaving something behind. I think this could happen to others too, since this tutorial is aimed for people who are new to Spring.

Update the Spring Boot version

An ongoing task is to keep the Spring Boot version current in the build files:

To do so, update the following files:

complete/build.gradle
complete/pom.xml
initial/build.gradle
initial/pom.xml

At least one JPA metamodel must be present!

the guides works fine for version 1.5.10.release;
but not work for starter-data-rest version 2.0.0.release when i try to test code by myself, got exception:

...
Caused by: java.lang.IllegalArgumentException: At least one JPA metamodel must be present!
...

and I've clone the bench upgrade-to-boot-2 then run the code but still not fine.
resolved it by add
@EnableAutoConfiguration(exclude={JpaRepositoriesAutoConfiguration.class})
in Application.java
and i'm find other solutions.

Config web.xml

how i can make configuration in web.xml, i found only using servlet 3.0 ?

Confusing statement in the documentation

In the documentation it is mentioned that:

Spring Data REST is a Spring MVC application. The @Import(RepositoryRestMvcConfiguration.class) annotation imports a collection of Spring MVC controllers, JSON converters, and other beans needed to provide a RESTful front end. These components link up to the Spring Data JPA backend.

However @Import(RepositoryRestMvcConfiguration.class) is not used anywhere in the sample app.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.