Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
Ask Question
I am using spring-data-rest on top of spring-data-gcp-datastore.
I am trying to explore my resource using HAL browser. Initially it works fine, so I see my elements:
"_embedded": {
"configurations": [
"data": "{\n \"test\": \"768\",\n \"test2\": 5\n}",
"_links": {
"self": {
"href": "http://localhost:8083/configurations/Key%7BprojectId=test,%20namespace=,%20path=%5BPathElement%7Bkind=configuration,%20id=null,%20name=k%7D%5D%7D"
"configuration": {
"href": "http://localhost:8083/configurations/Key%7BprojectId=test,%20namespace=,%20path=%5BPathElement%7Bkind=configuration,%20id=null,%20name=k%7D%5D%7D"
"_links": {
"self": {
"href": "http://localhost:8083/configurations{?page,size,sort}",
"templated": true
"profile": {
"href": "http://localhost:8083/profile/configurations"
"page": {
"size": 20,
"totalElements": 1,
"totalPages": 1,
"number": 0
But when I try to get one specific resource by following the provided link like
http://localhost:8083/configurations/Key%7BprojectId=test,%20namespace=,%20path=%5BPathElement%7Bkind=configuration,%20id=null,%20name=k%7D%5D%7D
I got an error:
org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [java.lang.String] to type [com.google.cloud.datastore.Key]
I have tried to create the converters and register them by this way:
@Component
public class WebConfig implements WebMvcConfigurer {
@Override
public void addFormatters(FormatterRegistry registry) {
System.out.println("^^^^^^^^^^^^^^^^^^^^^^^^^^^");
registry.addConverter(new KeyToStringConverter());
registry.addConverter(new StringToKeyConverter());
I see the printout, so the code has been executed, although printouts I have inside converters were not.
I have simple entity:
package com.test.appconfig.datastore.entities;
import lombok.Data;
import com.google.cloud.datastore.Key;
import org.springframework.cloud.gcp.data.datastore.core.mapping.Entity;
import org.springframework.data.annotation.Id;
@Entity
@Data
public class Configuration {
private Key id;
private String data;
And a simple repo:
@RepositoryRestResource
@Repository
@Transactional(isolation = Isolation.SERIALIZABLE)
public interface ConfigurationRepository extends DatastoreRepository<Configuration, Key>{
What are these missed converters and how can I register them?
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.