Grails: Preventing naming collisions
Since version 2.2 Grails, has better support for managing namespace configuration. This helps to prevent common namespace problems. For example most applications which have security functionality, have for example a UserDetailService which can conflict when you have the Grails SpringSecurity plugin installed. Grails version 2.2. and later comes with four useful techniques to make sure the right class is used
Aliases for Services
If Grails does not find an existing service with a similar name, Grails will automatically generate an alias for you service with the name of the plugin prefix. For example when you have a plugin called UserUtilities and a service called UserDetailService, you can use UserUtilitiesUserDetailService for dependency injection which will not conflict with the SpringSecurity UserDetailService
GORM Table prefixes for domain classes
When you have the grails.gorm.table.prefix.enabled set to true in you Config.groovy, Grails will use the plugin name as prefix for your database table. E.g. if you have a domain User in the UserUtilities plugin, the table name will become USER_UTILITIES_USER.
More specific URL mapping
The UrlMappings.groovy file has now a plugin attribute to specify a specific plugin
static mappings = {
"/userDetails" {
controller = 'userDetails'
plugin = 'userDetailsUtilities'
}
}
Plugin parameter for GSP controller tags
You now can add a plugin attribute to the link tag to specify the controller of a specific plugin
<g:link controller="userDetailController" plugin="UserUtilities">Manage Users</g:link>