Spring data aerospike
Asked Answered
N

3

5

I would like to work with Aerospike and use Spring Data. I found useful library for my goals here.

However, but adding it to dependencies, this code from sample still could not find dependencies.

@Configuration
@EnableAerospikeRepositories(basePackageClasses = 
ContactRepository.class)
class ApplicationConfig extends AbstractAerospikeConfiguration {
public @Bean(destroyMethod = "close") AerospikeClient aerospikeClient() {

    ClientPolicy policy = new ClientPolicy();
    policy.failIfNotConnected = true;

    return new AerospikeClient(policy, "localhost", 3000);
}

public @Bean AerospikeTemplate aerospikeTemplate() {
    return new AerospikeTemplate(aerospikeClient(), "bar");
}
}

Even less information could be find in the google. I've already tried to add another repos, like:

    <repositories>
    <repository>
        <id>spring-milestone</id>
        <url>https://repo.spring.io/libs-release</url>
    </repository>
</repositories>

Also, you could find example of project here. And guess what? That also won't be built.

I've installed latest Maven, updated repositories, still no result. Maybe I am missing some core dependencies?

EDIT:

I've added just like any other dependency. Firstly, It wasn't found at all, but after updating Maven that looked OK. However, I still couldn't import needed sources.

        <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-aerospike</artifactId>
        <version>1.5.0.RELEASE</version>
        </dependency>
Nutlet answered 9/4, 2017 at 11:39 Comment(2)
How did you add that spring-data-aerospike dependency? Could you show the related pom.xml snippet?Thynne
@romanpuchkovskiy, I've updated questionNutlet
T
4

That's pretty strange, but:

  1. It is not in the central: http://search.maven.org/#search%7Cga%7C1%7Cspring-data-aerospike
  2. It is not in spring's libs-release: https://repo.spring.io/libs-release/org/springframework/data/
  3. There IS a snapshot in libs-snapshot: https://repo.spring.io/libs-snapshot/org/springframework/data/spring-data-aerospike/
  4. Here http://www.aerospike.jp/docs/connectors/spring/tutorial_1.html the tutorial depends on spring-boot-starter-data-aerospike which has version 0.0.1-SNAPSHOT, and spring-boot-starter-data-aerospike is not in the plugins-release repository: https://repo.spring.io/plugins-release/org/springframework/boot/
  5. In their master pom.xml https://github.com/spring-projects/spring-data-aerospike/blob/master/pom.xml the version is 1.0.1.BUILD-SNAPSHOT which is not 1.5.0.RELEASE and which preceeds it
  6. There are no tags and no releases in their github repository.

So it looks like no public release was ever made, and their recommendation to 'Add the Maven dependency' (the one that you added, with version 1.5.0.RELEASE) will just not work.

To use this library in your project, you could make a checkout via git, build the project (mvn install), then use it from your local repository. Sources could be attached to your IDE manually. To build on other machines later, you could distribute the jar you built and use mvn deploy:deploy-file to install it to their local repositories.

Thynne answered 9/4, 2017 at 12:28 Comment(1)
also, you should run it like "mvn install -DskipTests"Nutlet
K
3

The Spring Data for Aerospike connector has been released using the com.aerospike group id and you can now download it from maven central.

A new example project has been created which uses Spring Data for Aerospike.

The tutorial has also been updated to match the example project.

Kilkenny answered 20/4, 2017 at 0:11 Comment(0)
C
1

These answers, including the accepted one are out of date. There have been many new developments in Spring Data Aerospike and the auto-configuration project aerospike-community/spring-boot-data-aerospike.

There is a modern example of Spring Boot using Aerospike and an associated February 2021 blog post Simple Web Application Using Java, Spring Boot, Aerospike and Docker. JARs are in Maven Central.

Other relatively recent blog posts are

Cursed answered 4/4, 2021 at 19:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.