matrei commented on PR #16019:
URL: https://github.com/apache/grails-core/pull/16019#issuecomment-5060209771

   Hey @codeconsole, this looks cool!
   
   I tried to get a feel for the DSL by converting the 
`UrlMappingsAutoConfiguration` and got the following error:
   
   `"grailsUrlConverter" is already used as the Spring bean name of another 
bean(...)`
   (adding `.primary()` did not help)
   
   ```groovy
   bean(UrlConverter, 'grailsUrlConverter')
           .conditionalOnMissingBeanName()
           .annotate(ConditionalOnProperty, name: 'grails.web.url.converter', 
havingValue: 'camelCase', matchIfMissing: true) {
               new CamelCaseUrlConverter()
           }
   
   bean(UrlConverter, 'grailsUrlConverter')
           .conditionalOnMissingBeanName()
           .annotate(ConditionalOnProperty, name: 'grails.web.url.converter', 
havingValue: 'hyphenated') {
               new HyphenatedUrlConverter()
           }
   ```
   
   I think I would find it more intuitive/readable by switching the type/name 
parameter order:
   ```groovy
   field('cacheUrls', Boolean).value('grails.web.linkGenerator.useCache')
   field('serverURL', String).value('grails.serverURL')
   
   method('fixedLocale', Locale) {
       Locale.default
   }
   
   bean('grailsUrlConverter', UrlConverter) {
       new MyUrlConverter()
   }
   ```
   
   You have put the documentation in the "Plugins" section, but wouldn't it be 
applicable to applications as well?
   Would it for example be possible to put `@GrailsBeans` on the `Application` 
class to define the beans?


-- 
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]

Reply via email to