matrei commented on code in PR #16019:
URL: https://github.com/apache/grails-core/pull/16019#discussion_r3702093276
##########
grails-doc/src/en/guide/conf/applicationClass/applicationLifeCycle.adoc:
##########
@@ -34,3 +34,5 @@ class Application extends GrailsAutoConfiguration {
...
}
----
+
+The `Application` class can also define its beans at compile time instead, by
annotating it with `@GrailsBeans` — see
link:spring.html#springdslAdditional[Configuring Additional Beans].
Review Comment:
Is the `@GrailsBeans` annotation necessary on the `Application` class?
##########
grails-domain-class/src/main/groovy/org/grails/plugins/domain/DomainClassGrailsPlugin.groovy:
##########
@@ -45,15 +55,26 @@ class DomainClassGrailsPlugin extends Plugin {
def dependsOn = [i18n: version]
def loadAfter = ['controllers', 'dataSource']
- @Override
- BeanRegistrar beanRegistrar() {
- return { BeanRegistry registry, Environment environment ->
- // Set default for auto-timestamp annotation caching based on
environment if not explicitly configured
- Config config = grailsApplication.config
- if
(!config.containsProperty(DatastoreSettings.SETTING_AUTO_TIMESTAMP_CACHE_ANNOTATIONS))
{
- // Not configured - disable caching in development mode to
support class reloading
-
config.put(DatastoreSettings.SETTING_AUTO_TIMESTAMP_CACHE_ANNOTATIONS,
- !grails.util.Environment.isDevelopmentMode())
+ // The deleted class held grailsApplication and messageSources as fields
populated by an
+ // @Autowired constructor. The generated sibling always has a no-arg
constructor, so both are
+ // taken as bean method parameters instead - resolved identically by
Spring, and only when the
+ // bean that needs them is created rather than when the configuration
class is instantiated.
Review Comment:
This comment is redundant.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]