Skip to content

Update reference documentation with examples that match @EnableMapRepositories #358

Closed
@sdavids

Description

@sdavids

https://docs.spring.io/spring-data/keyvalue/docs/current/reference/html/#key-value.template-configuration

Add/modify https://github.com/spring-projects/spring-data-examples/blob/master/map/src/test/java/example/springdata/map/PersonRepositoryIntegrationTest.java :

@RunWith(SpringRunner.class)
@SpringBootTest
public class PersonRepositoryIntegrationTest {

  static final class MapKeyValueAdapterExt extends MapKeyValueAdapter {

    MapKeyValueAdapterExt(Class<? extends Map> mapType) {
      super(mapType);
    }

    @Override
    public Object get(Object id, String keyspace) {
      System.out.println(keyspace + ":" + id);
      return super.get(id, keyspace);
    }
  }

  @SpringBootApplication
  @EnableMapRepositories
  static class Config {

    @Bean
    public KeyValueOperations keyValueTemplate() {
      return new KeyValueTemplate(keyValueAdapter());
    }

    @Bean
    public KeyValueAdapter keyValueAdapter() {
      return new MapKeyValueAdapterExt(ConcurrentHashMap.class);
    }
  }

// ...

}

MapKeyValueAdapterExt#get(Object, String) will not be called.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions