////
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.
////

=== Using GORM in Spring Boot
To use GORM for MongoDB in Spring Boot add the necessary dependencies to your Boot application:

[source,groovy,subs="attributes"]
----
compile("org.apache.grails:grails-data-mongodb-spring-boot:{version}")
----

Ensure your Boot `Application` class is annotated with `ComponentScan`, example:

[source,groovy]
----
import org.springframework.boot.SpringApplication
import org.springframework.boot.autoconfigure.EnableAutoConfiguration
import org.springframework.context.annotation.*

@Configuration
@EnableAutoConfiguration
@ComponentScan
class Application {
    static void main(String[] args) {
        SpringApplication.run Application, args
    }
}
----

NOTE: Using `ComponentScan` without a value results in Boot scanning for classes in the same package or any package nested within the `Application` class package.
If your GORM entities are in a different package specify the package name as the value of the `ComponentScan` annotation.

Finally create your GORM entities and ensure they are annotated with `grails.persistence.Entity`:

[source,groovy]
----
import grails.persistence.*

@Entity
class Person {
    String firstName
    String lastName
}
----
