Jackson @JsonFormat set date with one day less

Use this solution, it is more effective and modern than my solution: https://stackoverflow.com/a/45456037/4886918 Thanks @Benjamin Lucidarme. I resolved my problem using: @Temporal(TemporalType.DATE) @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = “dd/MM/yyyy”, locale = “pt-BR”, timezone = “Brazil/East”) private Date birthDate; I changed timezone to “Brazil/East” or “America/Sao_Paulo” and working now Thanks

Authentication and authorization in Spring Data REST

The best bet for you is Spring Security. That would help you achieve authorization is much simpler manner. Spring Security would require you an implementation that looks at request headers and performs the log-in operation programmatically. Refer the accepted answer here.. I had followed the same and implemented the security layer in front of my … Read more

How to get old entity value in @HandleBeforeSave event to determine if a property is changed or not?

If using Hibernate, you could simply detach the new version from the session and load the old version: @RepositoryEventHandler @Component public class PersonEventHandler { @PersistenceContext private EntityManager entityManager; @HandleBeforeSave public void handlePersonSave(Person newPerson) { entityManager.detach(newPerson); Person currentPerson = personRepository.findOne(newPerson.getId()); if (!newPerson.getName().equals(currentPerson.getName)) { //react on name change } } }

Can Spring Data REST’s QueryDSL integration be used to perform more complex queries?

I think you should be able to get this to work using the following customization: bindings.bind(user.dateOfBirth).all((path, value) -> { Iterator<? extends LocalDate> it = value.iterator(); return path.between(it.next(), it.next()); }); The key here is to use ?dateOfBirth=…&dateOfBirth= (use the property twice) and the ….all(…) binding which will give you access to all values provided. Make sure … Read more

How to mix spring-data-rest with spring websocket into a single implementation

Scenario 2 talks about, in the last step, a single client.But I thought your requirement was for a topic since you wanted multiple clients. If I wanted to complete 2 for your stated requirement, then you might want to maintain a list of clients and implement your own queue or use a ForkJoinPool to message … Read more

Multiple Repositories for the Same Entity in Spring Data Rest

The terrible part is not only that you can only have 1 spring data rest repository (@RepositoryRestResource) per Entity but also that if you have a regular JPA @Repository (like CrudRepository or PagingAndSorting) it will also interact with the spring data rest one (as the key in the map is the Entity itself). Lost quite … Read more

How to disable the default exposure of Spring Data REST repositories?

Looping back here as I was looking for this specific setting. It looks like this is now implemented. In this case, you would want to set spring.data.rest.detection-strategy=annotated to avoid default exposure. All application.properties options: # Exposes all public repository interfaces but considers @(Repository)RestResource\u2019s `exported flag. spring.data.rest.detection-strategy=default # Exposes all repositories independently of type visibility and … Read more

Why does RestTemplate not bind response representation to PagedResources?

As you’ve discovered correctly, PagedResources does not have an _embedded property, that’s why you don’t get the content property populated. This dilemma can be solved in two different ways: Providing a type that matches the representation in the first place. Thus, craft a custom class and either stick to the property names of the representation … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)