
Crud Rest Controller
Drop in correct Spring constructor or field injection snippets when scaffolding CRUD REST controllers in Java or Kotlin.
Install
npx skills add https://github.com/amplicode/spring-skills --skill crud-rest-controllerWhat is this skill?
- Constructor injection templates for single or multiple beans (repository, mapper)
- Java and Kotlin variants with documented insert points in the controller body
- Optional @Autowired field-injection alternative when you explicitly want it
- Variable table for BEAN_FQN, fieldName, and ControllerName placeholders
Adoption & trust: 1 installs on skills.sh; 54 GitHub stars; 3/3 security scanners passed (skills.sh audits); trending (+100% hot-view momentum).
Recommended Skills
Java Springbootgithub/awesome-copilot
Java Spring Bootpluginagentmarketplace/custom-plugin-java
Java Docsgithub/awesome-copilot
Kotlin Springbootgithub/awesome-copilot
Create Spring Boot Java Projectgithub/awesome-copilot
Java Refactoring Extract Methodgithub/awesome-copilot
Journey fit
Common Questions / FAQ
Is Crud Rest Controller safe to install?
skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.
SKILL.md
READMESKILL.md - Crud Rest Controller
# Bean injection into controller (Java) ## Insert Point Field and constructor parameter in the controller class body. ## Code ### defaults Constructor injection (single bean -- repository): ```java private final ${BEAN_FQN} ${fieldName}; public ${ControllerName}(${BEAN_FQN} ${fieldName}) { this.${fieldName} = ${fieldName}; } ``` ### multiple beans (repository + mapper) ```java private final ${BEAN_FQN_1} ${fieldName1}; private final ${BEAN_FQN_2} ${fieldName2}; public ${ControllerName}(${BEAN_FQN_1} ${fieldName1}, ${BEAN_FQN_2} ${fieldName2}) { this.${fieldName1} = ${fieldName1}; this.${fieldName2} = ${fieldName2}; } ``` ### field injection (alternative) ```java @org.springframework.beans.factory.annotation.Autowired private ${BEAN_FQN} ${fieldName}; ``` ## Variables | Variable | Source | Default | |----------|--------|---------| | `${BEAN_FQN}` | FQN of the bean class (repository, mapper, ObjectPatcher, ObjectMapper) | -- | | `${fieldName}` | decapitalized class name | -- | | `${ControllerName}` | controller class name | -- | # Bean injection into controller (Kotlin) ## Insert Point Primary constructor parameter in the controller class declaration. ## Code ### defaults Constructor injection (single bean -- repository): ```kotlin class ${ControllerName}( private val ${fieldName}: ${BEAN_FQN} ) ``` ### multiple beans (repository + mapper) ```kotlin class ${ControllerName}( private val ${fieldName1}: ${BEAN_FQN_1}, private val ${fieldName2}: ${BEAN_FQN_2} ) ``` ## Variables | Variable | Source | Default | |----------|--------|---------| | `${BEAN_FQN}` | FQN of the bean class (repository, mapper, ObjectPatcher, ObjectMapper) | -- | | `${fieldName}` | decapitalized class name | -- | | `${ControllerName}` | controller class name | -- | # Add JpaSpecificationExecutor to repository (Java) ## Insert Point Add `org.springframework.data.jpa.repository.JpaSpecificationExecutor<${EntityFqn}>` to the repository interface extends list. ## Code ### defaults Skip this fragment -- only applied when ALL of: (1) filter is selected, (2) entity is a JPA entity (has @Entity annotation), (3) repo does not already extend JpaSpecificationExecutor. ### when filter selected ```java public interface ${RepoName} extends org.springframework.data.jpa.repository.JpaRepository<${EntityFqn}, ${IdType}>, org.springframework.data.jpa.repository.JpaSpecificationExecutor<${EntityFqn}> { } ``` ## Variables | Variable | Source | Default | |----------|--------|---------| | `${RepoName}` | repository interface name | -- | | `${EntityFqn}` | entity FQN | -- | | `${IdType}` | entity ID type | -- | # Add JpaSpecificationExecutor to repository (Kotlin) ## Insert Point Add `org.springframework.data.jpa.repository.JpaSpecificationExecutor<${EntityFqn}>` to the repository interface extends list. ## Code ### defaults Skip this fragment -- only applied when ALL of: (1) filter is selected, (2) entity is a JPA entity (has @Entity annotation), (3) repo does not already extend JpaSpecificationExecutor. ### when filter selected ```kotlin interface ${RepoName} : org.springframework.data.jpa.repository.JpaRepository<${EntityFqn}, ${IdType}>, org.springframework.data.jpa.repository.JpaSpecificationExecutor<${EntityFqn}> ``` ## Variables | Variable | Source | Default | |----------|--------|---------| | `${RepoName}` | repository interface name | -- | | `${EntityFqn}` | entity FQN | -- | | `${IdType}` | entity ID type | -- | # Dependencies | Artifact ID | Group ID | Scope | Condition | |-------------|----------|-------|-----------| | spring-boot-starter-web | org.springframework.boot | implementation | always | | spring-boot-starter-data-jpa | org.springframework.boot | implementation | always | | amplicode-ra-utils | io.amplicode | implementation | when ObjectPatcher patch strategy selected | | spring-boot-starter-validation | org.springframework.boot | implementation | when entity has validation annotations | ## Gradle Kotlin D