跳到正文
cccskills
免费在 GitHub 公开

annotations

Conventions for using annotations in all tests using Jupiter

中文简介正在准备中。当前显示原文说明。

查看安装方法

包含的文件(1)

  • SKILL.md1.8 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

1. Make sure to use @param:Value eveywhere @Value is declared for Kotlin classes and files only

Remember to run tests after replacing all of them

2. Make sure to use interpolation prefixes for the @Value annotation in Kotlin classes and files only

Example 1 (applying to params)

Replace this:

class VirtualThreadsDemoApplication(
    val taskService: TaskService,
    @param:Value("\${org.jesperancinha.vtcc.tasks}") private val tasks: Int,
)

with this:

class VirtualThreadsDemoApplication(
    val taskService: TaskService,
    @param:Value($$"${org.jesperancinha.vtcc.tasks}") private val tasks: Int,
) 

Example 2 (applying to fields, on lateinit vars

Replace this:

class BankCompanyLauncherOtherPropertiesKotlinTest {
    /**
     * Properties and environment variables
     */
    @Value($$"${environment}")
    private lateinit var environment: String
}

with this:

class BankCompanyLauncherOtherPropertiesKotlinTest {
    /**
     * Properties and environment variables
     */
    @field:Value($$"${environment}")
    private lateinit var environment: String
}

The same should be applied to annotation @Autowired, but only for non-test classes and only in Kotlin files. The same should be applied to annotation @JsonProperty, @JsonDeserialize, @JsonAlias, @LocalServerPort, but only in Kotlin files. Do not add @Autowired, or any form of it with a different target to any parameter. @Autowired usage should be removed from production code instead.

3. Checklist

[] Make sure there is no more use of @Value annotation being used directly [] Make sure no @param:Value has been changed in a Java file [] Check that all @param:Value annotations are used correctly

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

angular

免费

Conventions for Angular applications

中文简介正在准备中。当前显示原文说明。

jesperancinha/healthy-cameras32026年8月11日 更新

docker

免费

Conventions for docker

中文简介正在准备中。当前显示原文说明。

jesperancinha/healthy-cameras32026年8月11日 更新

Conventions for using in all JEE frameworks. These are common standards for CDI

中文简介正在准备中。当前显示原文说明。

jesperancinha/healthy-cameras32026年8月11日 更新

Conventions for using in all JVM languages

中文简介正在准备中。当前显示原文说明。

jesperancinha/healthy-cameras32026年8月11日 更新

Conventions for using Java

中文简介正在准备中。当前显示原文说明。

jesperancinha/healthy-cameras32026年8月11日 更新

Conventions for using Kotlin

中文简介正在准备中。当前显示原文说明。

jesperancinha/healthy-cameras32026年8月11日 更新

查看 jesperancinha 的全部技能

报告此技能的问题