Fix example code highlighting for reactive examples.

Also, update documentation URLs.

Closes #1429
This commit is contained in:
Mark Paluch
2023-09-08 12:05:28 +02:00
parent d89a50bbd9
commit f63e7487ae
7 changed files with 29 additions and 133 deletions

View File

@@ -1,6 +1,3 @@
image:https://spring.io/badges/spring-data-cassandra/ga.svg[Spring Data for Apache Cassandra,link=https://projects.spring.io/spring-data-cassandra/#quick-start]
image:https://spring.io/badges/spring-data-cassandra/snapshot.svg[Spring Data for Apache Cassandra,link=https://projects.spring.io/spring-data-cassandra/#quick-start]
= Spring Data for Apache Cassandra image:https://jenkins.spring.io/buildStatus/icon?job=spring-data-cassandra%2Fmain&subject=Build[link=https://jenkins.spring.io/view/SpringData/job/spring-data-cassandra/] https://gitter.im/spring-projects/spring-data[image:https://badges.gitter.im/spring-projects/spring-data.svg[Gitter]]
The primary goal of the https://projects.spring.io/spring-data[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.
@@ -134,14 +131,14 @@ https://github.com/spring-projects/spring-data-cassandra/issues[issue tracker] t
== Building from Source
You dont need to build from source to use Spring Data (binaries in https://repo.spring.io[repo.spring.io]), but if you want to try out the latest and greatest, Spring Data can be easily built with the https://github.com/takari/maven-wrapper[maven wrapper].
You also need JDK 1.8.
You also need JDK 17.
[source,bash]
----
$ ./mvnw clean install
----
If you want to build with the regular `mvn` command, you will need https://maven.apache.org/run-maven/index.html[Maven v3.5.0 or above].
If you want to build with the regular `mvn` command, you will need https://maven.apache.org/run-maven/index.html[Maven v3.8.0 or above].
_Also see link:CONTRIBUTING.adoc[CONTRIBUTING.adoc] if you wish to submit pull requests, and in particular please sign the https://cla.pivotal.io/sign/spring[Contributors Agreement] before your first non-trivial change._
@@ -159,10 +156,10 @@ Building the documentation builds also the project without running tests.
[source,bash]
----
$ ./mvnw clean install -Pdistribute
$ ./mvnw clean install -Pantora
----
The generated documentation is available from `target/site/reference/html/index.html`.
The generated documentation is available from `spring-data-cassandra-distribution/antora/site/index.html`.
== Examples

View File

@@ -46,7 +46,7 @@ include::example$CqlTemplateExamples.java[tags=rowCount]
Reactive::
+
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
[source,java,indent=0,subs="verbatim,quotes",role="secondary"]
----
include::example$ReactiveCqlTemplateExamples.java[tags=rowCount]
----
@@ -65,7 +65,7 @@ include::example$CqlTemplateExamples.java[tags=countOfActorsNamedJoe]
Reactive::
+
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
[source,java,indent=0,subs="verbatim,quotes",role="secondary"]
----
include::example$ReactiveCqlTemplateExamples.java[tags=countOfActorsNamedJoe]
----
@@ -84,7 +84,7 @@ include::example$CqlTemplateExamples.java[tags=lastName]
Reactive::
+
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
[source,java,indent=0,subs="verbatim,quotes",role="secondary"]
----
include::example$ReactiveCqlTemplateExamples.java[tags=lastName]
----
@@ -103,7 +103,7 @@ include::example$CqlTemplateExamples.java[tags=rowMapper]
Reactive::
+
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
[source,java,indent=0,subs="verbatim,quotes",role="secondary"]
----
include::example$ReactiveCqlTemplateExamples.java[tags=rowMapper]
----
@@ -122,7 +122,7 @@ include::example$CqlTemplateExamples.java[tags=listOfRowMapper]
Reactive::
+
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
[source,java,indent=0,subs="verbatim,quotes",role="secondary"]
----
include::example$ReactiveCqlTemplateExamples.java[tags=listOfRowMapper]
----
@@ -143,7 +143,7 @@ include::example$CqlTemplateExamples.java[tags=findAllActors]
Reactive::
+
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
[source,java,indent=0,subs="verbatim,quotes",role="secondary"]
----
include::example$ReactiveCqlTemplateExamples.java[tags=findAllActors]
----
@@ -168,7 +168,7 @@ include::example$CqlTemplateExamples.java[tags=insert]
Reactive::
+
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
[source,java,indent=0,subs="verbatim,quotes",role="secondary"]
----
include::example$ReactiveCqlTemplateExamples.java[tags=insert]
----
@@ -187,7 +187,7 @@ include::example$CqlTemplateExamples.java[tags=update]
Reactive::
+
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
[source,java,indent=0,subs="verbatim,quotes",role="secondary"]
----
include::example$ReactiveCqlTemplateExamples.java[tags=update]
----
@@ -206,7 +206,7 @@ include::example$CqlTemplateExamples.java[tags=delete]
Reactive::
+
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
[source,java,indent=0,subs="verbatim,quotes",role="secondary"]
----
include::example$ReactiveCqlTemplateExamples.java[tags=delete]
----
@@ -255,7 +255,7 @@ template.setSessionFactory(new DefaultSessionFactory(session));
Reactive::
+
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
[source,java,indent=0,subs="verbatim,quotes",role="secondary"]
----
CqlSession session = … // get a Cassandra Session

View File

@@ -2,7 +2,7 @@
= Getting Started
Spring Data for Apache Cassandra requires Apache Cassandra 2.1 or later and Datastax Java Driver 4.0 or later.
An easy way to quickly set up and bootstrap a working environment is to create a Spring-based project in https://spring.io/tools[Spring Tools] or use https://start.spring.io/[Spring Initializer].
An easy way to quickly set up and bootstrap a working environment is to create a Spring-based project in https://spring.io/tools[Spring Tools] or use https://start.spring.io/#!type=maven-project&dependencies=data-cassandra[start.spring.io].
[[cassandra.examples-repo]]
== Examples Repository
@@ -89,7 +89,7 @@ include::example$CassandraApplication.java[tags=file]
Reactive::
+
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
[source,java,indent=0,subs="verbatim,quotes",role="secondary"]
----
include::example$ReactiveCassandraApplication.java[tags=file]
----

View File

@@ -33,7 +33,7 @@ include::example$CqlTemplateExamples.java[tags=lastName]
Reactive::
+
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
[source,java,indent=0,subs="verbatim,quotes",role="secondary"]
----
include::example$ReactiveCqlTemplateExamples.java[tags=lastName]
----
@@ -52,7 +52,7 @@ include::example$CqlTemplateExamples.java[tags=preparedStatement]
Reactive::
+
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
[source,java,indent=0,subs="verbatim,quotes",role="secondary"]
----
include::example$ReactiveCqlTemplateExamples.java[tags=preparedStatement]
----
@@ -83,7 +83,7 @@ include::example$CassandraTemplateExamples.java[tags=preparedStatement]
Reactive::
+
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
[source,java,indent=0,subs="verbatim,quotes",role="secondary"]
----
include::example$ReactiveCassandraTemplateExamples.java[tags=preparedStatement]
----

View File

@@ -41,7 +41,7 @@ interface PersonRepository extends CrudRepository<Person, String> {
Reactive::
+
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
[source,java,indent=0,subs="verbatim,quotes",role="secondary"]
----
interface PersonRepository extends ReactiveCrudRepository<Person, String> {

View File

@@ -62,7 +62,7 @@ private CassandraOperations cassandraOperations;
Reactive::
+
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
[source,java,indent=0,subs="verbatim,quotes",role="secondary"]
----
@Autowired
private ReactiveCassandraOperations reactiveCassandraOperations;
@@ -85,7 +85,7 @@ private CassandraOperations cassandraOperations;
Reactive::
+
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
[source,java,indent=0,subs="verbatim,quotes",role="secondary"]
----
@Autowired
@Qualifier("keyspaceOneTemplateBeanId")
@@ -110,7 +110,7 @@ CassandraOperations cassandraOperations = applicationContext.getBean("cassandraT
Reactive::
+
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
[source,java,indent=0,subs="verbatim,quotes",role="secondary"]
----
ReactiveCassandraOperations cassandraOperations = applicationContext.getBean("ReactiveCassandraOperations", ReactiveCassandraOperations.class);
----
@@ -151,7 +151,7 @@ List<Person> result = cassandraTemplate.select(query(where("age").is(50))
Reactive::
+
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
[source,java,indent=0,subs="verbatim,quotes",role="secondary"]
----
import static org.springframework.data.cassandra.core.query.Criteria.where;
import static org.springframework.data.cassandra.core.query.Query.query;
@@ -249,7 +249,7 @@ List<SWCharacter> all = ops.query(SWCharacter.class)
Reactive::
+
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
[source,java,indent=0,subs="verbatim,quotes",role="secondary"]
----
Flux<SWCharacter> all = ops.query(SWCharacter.class)
.inTable("star_wars") <1>
@@ -278,7 +278,7 @@ List<Jedi> all = ops.query(SWCharacter.class) <1>
Reactive::
+
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
[source,java,indent=0,subs="verbatim,quotes",role="secondary"]
----
Flux<Jedi> all = ops.query(SWCharacter.class) <1>
.as(Jedi.class) <2>
@@ -347,7 +347,7 @@ Person queriedBob = cassandraTemplate.selectOneById(query(where("age").is(33)),
Reactive::
+
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
[source,java,indent=0,subs="verbatim,quotes",role="secondary"]
----
import static org.springframework.data.cassandra.core.query.Criteria.where;
import static org.springframework.data.cassandra.core.query.Query.query;
@@ -385,7 +385,7 @@ cassandraTemplate().getCqlOperations().execute(cql);
Reactive::
+
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
[source,java,indent=0,subs="verbatim,quotes",role="secondary"]
----
String cql = "INSERT INTO person (age, name) VALUES (39, 'Bob')";
@@ -446,7 +446,7 @@ boolean applied = cassandraTemplate.update(Query.query(where("id").is("foo")),
Reactive::
+
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
[source,java,indent=0,subs="verbatim,quotes",role="secondary"]
----
import static org.springframework.data.cassandra.core.query.Criteria.where;
import org.springframework.data.cassandra.core.query.Query;

View File

@@ -1,101 +0,0 @@
[[preface]]
= Preface
The Spring Data for Apache Cassandra project applies core Spring concepts to the development of solutions using the Cassandra Columnar data store.
A "`template`" is provided as a high-level abstraction for storing and querying documents.
This project has noticeable similarities to the {springDocsUrl}data-access.html#jdbc[JDBC support]
in the core Spring Framework.
This document is the reference guide for Spring Data support for Cassandra.
It explains Cassandra module concepts and semantics and the syntax for various stores namespaces.
This section provides a basic introduction to Spring, Spring Data, and the Cassandra database.
The rest of the document refers only to Spring Data for Apache Cassandra features and assumes you are familiar with Cassandra as well as core Spring concepts.
[[get-started:first-steps:spring]]
== Knowing Spring
Spring Data uses the Spring Framework's {springDocsUrl}core.html[core]
functionality, including:
* {springDocsUrl}core.html#beans[IoC] container
* {springDocsUrl}core.html#validation[validation, type conversion and data binding]
* {springDocsUrl}core.html#expressions[expression language]
* {springDocsUrl}core.html#aop[AOP]
* {springDocsUrl}integration.html#jmx[JMX integration]
* {springDocsUrl}data-access.html[DAO support]
* {springDocsUrl}data-access.html#dao-exceptions[DAO Exception Hierarchy]
While it is not important to know the Spring APIs, understanding the concepts behind them is important.
At a minimum, the idea behind IoC should be familiar, no matter what IoC container you choose to use.
The core functionality of the Cassandra support can be used directly, with no need to invoke the IoC services of the Spring container.
This is much like `JdbcTemplate`, which can be used 'standalone' without any other services of the Spring container.
To use all the features of Spring Data for Apache Cassandra, such as the repository support, you must configure some parts of the library by using Spring.
To learn more about Spring, you can refer to the comprehensive {springDocsUrl}[documentation]
that explains the Spring Framework in detail.
There are a lot of articles, blog entries, and books on Spring.
See the Spring Framework https://spring.io/projects/spring-framework[home page] for more information.
[[get-started:first-steps:nosql]]
== Knowing NoSQL and Cassandra
NoSQL stores have taken the storage world by storm.
It is a vast domain with a plethora of solutions, terms, and patterns.
(To make things worse, even the term itself has multiple https://www.google.com/search?q=nosoql+acronym[meanings].) While some of the principles are common, it is crucial that you be familiar to some degree with the Cassandra Columnar NoSQL Datastore supported by Spring Data for Apache Cassandra.
The best way to get acquainted with Cassandra is to read the documentation and follow the examples.
It usually does not take more then 5-10 minutes to go through them, and, if you come from a RDBMS background, these exercises can often be an eye opener.
The starting point for learning about Cassandra is https://cassandra.apache.org/[cassandra.apache.org].
Also, here is a list of other useful resources:
* The https://datastax.com/[DataStax] site offers https://www.datastax.com/products/datastax-enterprise[commercial support]
and many resources, including, but not limited to, https://docs.datastax.com/en/home/docs/index.html[documentation], and https://docs.datastax.com/en/home/docs/index.html[DataStax Academy].
* The https://academy.datastax.com/resources/ds101-introduction-cassandra[DataStax Academy introduction to Cassandra].
* The https://cassandra.apache.org/doc/latest/getting_started/index.html[Cassandra Quick Start Guide].
[[requirements]]
== Requirements
Spring Data for Apache Cassandra 2.x binaries require JDK level 8.0 and later and https://spring.io/docs[Spring Framework] {springVersion} and later.
It requires https://cassandra.apache.org/[Cassandra] 2.0 or later and Datastax driver 4.x.
[[additional-help-resources]]
== Additional Help Resources
Learning a new framework is not always straight forward.
In this section, we try to provide what we think is an easy-to-follow guide for starting with the Spring Data for Apache Cassandra module.
However, if you encounter issues or you need advice, feel free to use one of the links below:
[[get-started:help:community]]
Community Forum::
Spring Data on https://stackoverflow.com/questions/tagged/spring-data[Stack Overflow] is a tag for all Spring Data (not just Cassandra) users to share information and help each other.
Note that registration is needed only for posting.
The two key tags to search for related answers to this project are https://stackoverflow.com/questions/tagged/spring-data[spring-data] and https://stackoverflow.com/questions/tagged/spring-data-cassandra[spring-data-cassandra].
[[get-started:help:professional]]
Professional Support::
Professional, from-the-source support, with guaranteed response time, is available from
https://pivotal.io/[Pivotal Software, Inc.], the company behind Spring Data and Spring.
[[get-started:up-to-date]]
=== Following Development
For information on the Spring Data for Apache Cassandra source code repository, nightly builds, and snapshot artifacts see the https://spring.io/projects/spring-data-cassandra[Spring Data for Apache Cassandra home page].
You can help make Spring Data best serve the needs of the Spring community by interacting with developers through the community on https://stackoverflow.com/questions/tagged/spring-data[Stack Overflow].
To follow developer activity, look for the mailing list information on the Spring Data for Apache Cassandra home page.
If you encounter a bug or want to suggest an improvement, please create a ticket on the Spring Data issue
https://github.com/spring-projects/spring-data-cassandra/issues[tracker].
To stay up-to-date with the latest news and announcements in the Spring ecosystem, subscribe to the Spring Community https://spring.io[Portal].
Finally, you can follow the Spring https://spring.io/blog[blog] or the project team on Twitter (https://twitter.com/SpringData[SpringData]).
[[get-started:project-metadata]]
=== Project Metadata
* Version Control: https://github.com/spring-projects/spring-data-cassandra
* Bugtracker: https://github.com/spring-projects/spring-data-cassandra/issues
* Release repository: https://repo1.maven.org/maven2/
* Milestone repository: https://repo.spring.io/milestone/
* Snapshot repository: https://repo.spring.io/snapshot/