spring-projects / spring-data-commons

Spring Data Commons. Interfaces and code shared between the various datastore specific implementations.
https://spring.io/projects/spring-data
Apache License 2.0
772 stars 672 forks source link

Investigate option to toggle imperative/reactive configuration bits in documentation #2918

Open christophstrobl opened 1 year ago

christophstrobl commented 1 year ago

For some features (eg. auditing) the actual usage patterns are not that different between the imperative and reactive bits. Still the configuration may differ. So there may be options to reduce duplication and potentially simplify the documentation by having toggles that allow to switch code snippets for those parts.

mp911de commented 1 year ago

There are tabbed switchers available, see https://github.com/spring-projects/spring-framework/blob/v6.0.11/framework-docs/modules/ROOT/pages/data-access/jdbc/core.adoc:

[tabs]
======
Java::
+
[source,java,indent=0,subs="verbatim,quotes",role="primary"]
----
    List<Actor> actors = this.jdbcTemplate.query(
            "select first_name, last_name from t_actor",
            (resultSet, rowNum) -> {
                Actor actor = new Actor();
                actor.setFirstName(resultSet.getString("first_name"));
                actor.setLastName(resultSet.getString("last_name"));
                return actor;
            });
----

Kotlin::
+
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
----
    val actors = jdbcTemplate.query("select first_name, last_name from t_actor") { rs, _ ->
            Actor(rs.getString("first_name"), rs.getString("last_name"))
----
======
mp911de commented 1 year ago

Seems we applied this in several places. Anything left to do here?