This project is generated by Grace v2023.0.1.
- Use static property
scaffold
, will generateUserController
extended built-inRestfulController
class UserController {
static scaffold = User
}
- Use static property
scaffold
, but extended custom super Controller class
class UserController extends SubclassRestfulController<User> {
static scaffold = Use
// Not supported above Grails 3.0, but I think it's ok if super controller use generic of Domain Class
// static scaffold = true
// This allow you to override methods
UserDataService userDataService
UserController() {
super(User, false)
}
@Override
protected User createResource() {
User user = new User()
bindData user, getObjectToBind()
user
}
@Override
protected User queryForResource(Serializable id) {
return this.userDataService.get(id)
}
}
- Use
@Scaffold
annotation, same as 1
@Scaffold(User)
class UserController {
}
- Use
@Scaffold
annotation, same as 2
@Scaffold(value=User, superClass=SubclassRestfulController)
class UserController {
}
- Grace 2023.0.1
- Groovy 4.0.22
- Spring Boot 3.0.13
- Spring Framework 6.0.23
- Tomcat 10.1.28