-
Notifications
You must be signed in to change notification settings - Fork 475
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HTTP PUT doesn't do update, but new #250
Comments
But given that I was able to take your domain objects, use Spring Boot 1.1.6.RELEASE (which uses the latest release of Spring Data REST + HATEOAS) and see everything work properly in https://github.com/gregturn/brands, I don't think this is an issue. |
Thanks a lot!! Your code works, and i'll try to find the differences and post them here. |
I'm with the same problem but using spring platform, maybe it's a problem with dependencies |
This problem occurs when i use domainClassConverter, if i remove this code it works perfectly. @Bean
public FormattingConversionService mvcConversionService() {
FormattingConversionService conversionService = new DefaultFormattingConversionService();
addFormatters(conversionService);
return conversionService;
}
@Bean
public DomainClassConverter<?> domainClassConverter() {
return new DomainClassConverter<FormattingConversionService>(mvcConversionService());
} |
Based upon spring-projects/spring-boot#1514 and https://github.com/gregturn/brands, this issue is deemed invalid. Regarding the newly added issue, please open a new ticket if you are still having issues. It's hard to sort out two unrelated things in one ticket. |
HTTP PUT doesn't seem to work ok with PagingAndSortingRepository.
Not in my code (see below) but also not in spring-boot-sample-rest code (spring-projects/spring-boot#1514)
When I try to do an update with HTTP PUT of a simple json object 'brand', a new brand is created.
I use only a standard respository (see below) with a simple brand model (see below). When I do an update in code using the repository, the brand is actually modified.
Any help would be really appreciated, i'm breaking my head over this
My curl output (the field 'Location: http://localhost:8181/brands/13' shows that a new brand is created):
$ curl -v -X PUT -d '{"name":"Alibastine"}' -H "Content-Type: application/json" http://localhost:8181/brands/1
< HTTP/1.1 204 No Content
< Server: Apache-Coyote/1.1
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Headers: X-Requested-With, Origin, Content-Type, Accept
< Location: http://localhost:8181/brands/13
< Date: Thu, 04 Sep 2014 17:33:10 GMT
BrandRepository.java:
import java.util.List;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.history.RevisionRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import com.builder.ws.models.entities.Brand;
@RepositoryRestResource(collectionResourceRel = "brands", path = "brands")
public interface BrandRepository extends PagingAndSortingRepository<Brand, Long>
{
}
Brand.java:
import java.net.URL;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.Table;
import javax.validation.constraints.Size;
@entity
public class Brand {
@id
@GeneratedValue
public Long id;
}
Regards,
Bas
The text was updated successfully, but these errors were encountered: