Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit 91a7dff

Browse files
committed
BootStrap init closure servletContext cleanup
1 parent 75ffe0e commit 91a7dff

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
package example
22

3+
import jakarta.servlet.ServletContext
4+
35
class BootStrap {
46

5-
def init = { servletContext ->
7+
ServletContext servletContext
8+
9+
def init = {
610
}
11+
712
def destroy = {
813
}
914
}
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
package functional.tests
22

3+
import jakarta.servlet.ServletContext
34
import org.grails.orm.hibernate.HibernateDatastore
45

56
class BootStrap {
67

8+
ServletContext servletContext
79
HibernateDatastore hibernateDatastore
810

9-
def init = { servletContext ->
11+
def init = {
1012
assert hibernateDatastore.connectionSources.defaultConnectionSource.settings.hibernate.getConfigClass() == CustomHibernateMappingContextConfiguration
1113
Product.withTransaction {
1214
new Product(name: "MacBook", price: "1200.01").save()
1315
}
1416
}
17+
1518
def destroy = {
1619
}
1720
}

examples/issue450/grails-app/init/multitenantcomposite/BootStrap.groovy

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@ package multitenantcomposite
22

33
import grails.gorm.multitenancy.Tenants
44
import groovy.transform.CompileStatic
5+
import jakarta.servlet.ServletContext
56

67
@CompileStatic
78
class BootStrap {
89

10+
ServletContext servletContext
911
BookService bookService
1012

11-
def init = { servletContext ->
13+
def init = {
1214
String grailsId = UUID.randomUUID().toString()
1315
Tenants.withId("grails") {
1416
bookService.save(grailsId, "The definitive Guide to Grails 2")

0 commit comments

Comments
 (0)