Skip to content

Latest commit

 

History

History
61 lines (44 loc) · 1.47 KB

README.md

File metadata and controls

61 lines (44 loc) · 1.47 KB

Spring Data MapDB

This is Spring Data module for a MapDB: database engine Many thanks to Spring Data Hazelcast for an inspiration.

Installation

<dependency>
    <groupId>com.github.mrfrag</groupId>
    <artifactId>spring-data-mapdb</artifactId>
    <version>0.1.0</version>
</dependency>

Usage

Configuration sample.

@Configuration
@EnableMapDbRepositories(basePackages = "your.fancy.package")
public class RepositoryConfiguration {

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

}

or

@Configuration
@EnableMapDbRepositories(basePackageClasses = { YourFancyRepository.class})
public class RepositoryConfiguration {

	@Bean
	public KeyValueTemplate keyValueTemplate() {
		DB db = DBMaker.fileDB("/wherever/it/is/foo.db").make();
		return new KeyValueTemplate(new MapDbKeyValueAdapter(db));
	}

}

for detailed example check src/test/java/org/springframework/data/mapdb/example/

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

License

MIT License