Skip to content

Latest commit

 

History

History
75 lines (50 loc) · 1.3 KB

README.md

File metadata and controls

75 lines (50 loc) · 1.3 KB

banana

This project is generated by Grace v2023.0.1.

Scaffolding

  1. Use static property scaffold, will generate UserController extended built-in RestfulController
class UserController {

    static scaffold = User

}
  1. 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)
    }

}
  1. Use @Scaffold annotation, same as 1
@Scaffold(User)
class UserController {

}
  1. Use @Scaffold annotation, same as 2
@Scaffold(value=User, superClass=SubclassRestfulController)
class UserController {

}

Versions

  • Grace 2023.0.1
  • Groovy 4.0.22
  • Spring Boot 3.0.13
  • Spring Framework 6.0.23
  • Tomcat 10.1.28