从Grails3.2升级到Grails3.3,不推荐使用GrailDomainClass Api
为了将我的应用程序和插件升级到Grails3.3,我做了以下替换。(变量名称的更改是为了提高替换的清晰度。) Grails 3.2:从Grails3.2升级到Grails3.3,不推荐使用GrailDomainClass Api,grails,grails-plugin,grails-3.3,Grails,Grails Plugin,Grails 3.3,为了将我的应用程序和插件升级到Grails3.3,我做了以下替换。(变量名称的更改是为了提高替换的清晰度。) Grails 3.2: Class<?> clazz = grailsDomainClass.clazz ... def grailsDomainClass = new DefaultGrailsDomainClass(clazz) ... GrailsDomainClassProperty[] properties = grailsDomainClass.propert
Class<?> clazz = grailsDomainClass.clazz
...
def grailsDomainClass = new DefaultGrailsDomainClass(clazz)
...
GrailsDomainClassProperty[] properties = grailsDomainClass.properties
...
def propertyName = grailsDomainClass.propertyName
...
def referenceType = grailsDomainClassProperty.referencedPropertyType
...
doWithSpring
中的代码放在我的插件的哪里doWithContext
closure?它可以用来注射豆子吗
ClassPropertyFetcher.getPropertyValue
方法doWithApplicationContext
是一种可以覆盖插件的方法,您可以在其中放置逻辑在grails数据存储6.0.9
org.grails.datastore.mapping.reflect.ClassPropertyFetcher
中,可以返回非静态属性值。但在6.1.6中,只能提取静态特性值。什么改变了?
Class<?> clazz = persistentEntity.javaClass
...
def persistentEntity = grailsApplication.mappingContext.getPersistentEntity(DomainClass.class.name)
...
PersistentProperty[] properties = persistentEntity.persistentProperties
...
def propertyName = persistentEntity.decapitalizedName
...
def referenceType = persistentProperty.type
grailsDomainClass.getPropertyValue(propertyName)