repositoryAnnotations

Talks about:

The additional annotations to be placed on generated repository classes.

This is how a generated repository becomes a bean. org.springframework.stereotype.Repository makes component scanning find it; jakarta.enterprise.context.ApplicationScoped makes CDI find it. Either way constructor injection supplies the DataSource, and no configuration class is needed — see Spring Boot and Quarkus .

Name annotations by their fully-qualified name; the import is written for you. The annotation has to be on the compile classpath of the project being generated for, since the generated code has to compile against it — but it is your dependency, not one of YoSQL’s.

Configuration Options

Option: ‘org.springframework.stereotype.Repository’

Spring finds the repository by scanning, and injects the application’s DataSource:

package com.example.persistence;

import org.springframework.stereotype.Repository;

@Repository
public final class TenantRepository {

    // ... rest of generated code

}

Option: ‘jakarta.enterprise.context.ApplicationScoped’

The same under CDI, so Quarkus and Jakarta EE inject it:

package com.example.persistence;

import jakarta.enterprise.context.ApplicationScoped;

@ApplicationScoped
public final class TenantRepository {

    // ... rest of generated code

}

Also in this group: constructorAnnotations , methodAnnotations .

Tooling

Ant

In order to use YoSQL together with Ant , take a look at the tooling documentation for Ant .

Bazel

In order to use YoSQL together with Bazel , take a look at the tooling documentation for Bazel .

CLI

In order to use YoSQL on the command line, take a look at the tooling documentation for CLI .

yosql --annotations-repository-annotations=configValue

As long as the name of the config option is unique across all configuration groups, you can use the shorter form:

yosql --repository-annotations=configValue

Gradle

In order to use YoSQL together with Gradle , take a look at the tooling documentation for Gradle . The repositoryAnnotations setting can be configured using Gradle in Kotlin syntax like this:

plugins {
  java
  id("wtf.metio.yosql") version "2023.2.22"
}

yosql {
  annotations {
    repositoryAnnotations.set(configValue)
  }
}

or in Groovy syntax like this:

plugins {
  id "java"
  id "wtf.metio.yosql" version "2023.2.22"
}

yosql {
  annotations {
    repositoryAnnotations = configValue
  }
}

Maven

In order to use YoSQL together with Maven , take a look at the tooling documentation for Maven . The repositoryAnnotations setting can be configured using Maven like this:

<build>
  <plugins>
    <plugin>
      <groupId>wtf.metio.yosql</groupId>
      <artifactId>yosql-tooling-maven</artifactId>
      <version>2023.2.22</version>
      <configuration>
        <annotations>
          <repositoryAnnotations>configValue</repositoryAnnotations>
        </annotations>
      </configuration>
    </plugin>
  </plugins>
</build>