////
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
////


== domainClass



=== Purpose


The `domainClass` plugin configures Grails domain classes as prototyped beans in the Spring `ApplicationContext`


=== Examples


An example domain class:

[source,groovy]
----
class Book {
    String title
    Date releaseDate
    Author author
}
----


=== Description


Refer to the section on  link:{hibernate5GuideFromRef}[GORM] in the Grails user guide which details how to create Grails domain classes.

Configured Spring Beans given a domain class of `Book`:

* `BookValidator` - A link:{apiFromRef}grails/gorm/validation/PersistentEntityValidator.html[PersistentEntityValidator] that validates a domain class' defined link:{guidePath}validation.html#constraints[Constraints].
* `BookPersistentClass` - The `Class` for the domain class `Book`
* `BookDomainClass` - The link:{apiFromRef}grails/core/GrailsDomainClass.html[GrailsDomainClass] instance which understands the conventions defined within a domain class and is used by link:{guidePath}GORM.html[GORM] to perform ORM mapping.
* `Book` - A prototyped bean that will create a new instance of `Book` every time requested. This bean is used to perform auto-wiring of domain classes when constructed with the `new` operator.
