Reputation: 163
I have made the following replacements to upgrade my applications and plugins to grails 3.3. (the variable name change is due to improve clarity of the replacements.)
Grails 3.2:
Class<?> clazz = grailsDomainClass.clazz
...
def grailsDomainClass = new DefaultGrailsDomainClass(clazz)
...
GrailsDomainClassProperty[] properties = grailsDomainClass.properties
...
def propertyName = grailsDomainClass.propertyName
...
def referenceType = grailsDomainClassProperty.referencedPropertyType
...
Grails 3.3:
Class<?> clazz = persistentEntity.javaClass
...
def persistentEntity = grailsApplication.mappingContext.getPersistentEntity(DomainClass.class.name)
...
PersistentProperty[] properties = persistentEntity.persistentProperties
...
def propertyName = persistentEntity.decapitalizedName
...
def referenceType = persistentProperty.type
The other changes are at Grails 3.3 man.
Witch is not clear is:
What is the replacement for:
grailsDomainClass.getPropertyValue(propertyName)
Where do I put the code which is in doWithSpring
on my plugins?
The man page says:
The solution is to move any logic that executes before the context is available to somewhere else that executes after the context is available.
Somewhere else were? Is there a doWithContext
closure? It can be used to inject bean?
Upvotes: 3
Views: 1173
Reputation: 12238
Use the ClassPropertyFetcher.getPropertyValue
method
doWithApplicationContext
is a method available to override for plugins where you can put your logic.
Upvotes: 3