methodAnnotations
The additional annotations to be placed on generated methods.
Goes on every generated method of every repository, which limits it to annotations that
make sense everywhere — a metrics @Timed, a @SuppressWarnings.
Resist putting @Transactional here. It would open a transaction per statement, which is
the opposite of what a transaction is for; transactions belong to the service calling
several statements, and transactions
covers how a repository
joins one.
To annotate one statement rather than all of them, use annotations in its front matter.
Configuration Options
Option: ‘io.micrometer.core.annotation.Timed’
Every statement is measured:
package com.example.persistence;
import io.micrometer.core.annotation.Timed;
public final class TenantRepository {
@Timed
public Optional<Tenant> findTenant(final UUID id) {
// ... rest of generated code
}
}
Related Options
Also in this group: constructorAnnotations , repositoryAnnotations .
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 generate --annotations-method-annotations=configValue
Gradle
In order to use YoSQL together with Gradle
, take a look at the tooling documentation for Gradle
. The methodAnnotations setting can be configured using Gradle in Kotlin syntax like this:
plugins {
java
id("wtf.metio.yosql") version "2026.8.8"
}
yosql {
annotations {
methodAnnotations.set(configValue)
}
}
or in Groovy syntax like this:
plugins {
id "java"
id "wtf.metio.yosql" version "2026.8.8"
}
yosql {
annotations {
methodAnnotations = configValue
}
}
Maven
In order to use YoSQL together with Maven
, take a look at the tooling documentation for Maven
. The methodAnnotations setting can be configured using Maven like this:
<build>
<plugins>
<plugin>
<groupId>wtf.metio.yosql.tooling</groupId>
<artifactId>yosql-tooling-maven</artifactId>
<version>2026.8.8</version>
<configuration>
<annotations>
<methodAnnotations>configValue</methodAnnotations>
</annotations>
</configuration>
</plugin>
</plugins>
</build>