Git Product home page Git Product logo

sdn-rx's Introduction

Spring Data Neo4j⚡️RX

Maven Central

Spring Data Neo4j⚡️RX - or in short SDN/RX - is an ongoing effort to create the next generation of Spring Data Neo4j, with full reactive support and lightweight mapping. SDN/RX will work with immutable entities, regardless whether written in Java or Kotlin.

The primary goal of the Spring Data project is to make it easier to build Spring-powered applications that use new data access technologies such as non-relational databases, map-reduce frameworks, and cloud based data services.

The SDN/RX project aims to provide a familiar and consistent Spring-based programming model for integrating with the Neo4j Graph Database.

Manual

For a gentle introduction and some getting started guides, please use our Manual.

Getting Started

Here is a quick teaser of a reactive application using Spring Data Repositories in Java, without using Spring Boot.

@Node
public class Person {
    private Long id;
    private String name;

    public Person(String name) {
        this.name = name;
    }
}

@Repository
interface PersonRepository extends ReactiveNeo4jRepository<Person, Long> {

    Flux<Person> findAllByName(String name);

    Flux<Person> findAllByNameLike(String name);
}

@Service
class MyService {

    @Autowired
    private final PersonRepository repository;

    @Transactional
    public Flux<Person> doWork() {

        Person emil = new Person("Emil");
        Person gerrit = new Person("Gerrit");
        Person michael = new Person("Michael");

        // Persist entities and relationships to graph database
        return repository.saveAll(Flux.just(emil, gerrit, michael));
    }
}

@Configuration
@EnableReactiveNeo4jRepositories
@EnableTransactionManagement
class MyConfiguration extends AbstractReactiveNeo4jConfig {

    @Bean
    public Driver driver() {
        return GraphDatabase.driver("bolt://localhost:7687", AuthTokens.basic("neo4j", "passphrase"));
    }

    @Override
    protected Collection<String> getMappingBasePackages() {
        return Collections.singletonList(Person.class.getPackage().getName());
    }
}
Tip
SDN/RX is not only about reactive support, all features are available in both ways: Imperative and reactive, we only prefer to showcase the new reactive database access support here.

Maven configuration

Add the Maven dependency:

<dependency>
	<groupId>org.neo4j.springframework.data</groupId>
	<artifactId>spring-data-neo4j-rx</artifactId>
	<version>1.0.0-beta04</version>
</dependency>

Nowadays, people prefer Spring Boot and we got you covered with a starter. Please consult our manual for more information.

Building SDN/RX

Please have a look at the documentation: Building SDN/RX.

sdn-rx's People

Contributors

atomfrede avatar dependabot[bot] avatar jansur avatar karvozavr avatar meistermeier avatar michael-simons avatar thephil avatar viveksb007 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.