Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

83 lines (60 sloc) 3.716 kB
h4. Namespace Support
Grails 2.2 includes improved support for managing naming conflicts between artifacts provided by an application and its plugins.
Bean names for Service artifacts provided by a plugin are now prefixed with the plugin name. For example, if a Service named @com.publishing.AuthorService@ is provided by
a plugin named @PublishingUtilities@ and another Service named @com.bookutils.AuthorService@ is provided by a plugin named @BookUtilities@, the bean names for those services
will be @publishingUtilitiesAuthorService@ and @bookUtilitiesAuthorService@ respectively. If a plugin provides a Service that does not have a name which conflicts with any
other Service, then a bean alias will automatically be created that does not contain the prefix and the alias will refer to the bean referenced by the prefixed name. Service
artifacts provided directly by the application will have no prefix added to the relevant bean name. See the [dependency injection and services|guide:dependencyInjectionServices] docs.
Domain classes provided by a plugin will have their default database table name prefixed with the plugin name if the @grails.gorm.table.prefix.enabled@ config property is
set to @true@. For example, if the @PublishingUtilities@ plugin provides a domain class named @Book@, the default table name for that domain class will be
@PUBLISHING_UTILITIES_BOOK@ if the @grails.gorm.table.prefix.enabled@ config property is set to @true@.
URL Mappings may now include a @plugin@ attribute to indicate that the controller referenced in the mapping is provided by a particular plugin.
{code:java}
static mappings = {
// requests to /bookAuthors will be handled by the
// AuthorController provided by the BookUtilities plugin
"/bookAuthors" {
controller = 'author'
plugin = 'bookUtilities'
}
// requests to /publishingAuthors will be handled by the
// AuthorController provided by the Publishing plugin
"/publishingAuthors" {
controller = 'author'
plugin = 'publishing'
}
}
{code}
See the [namespaced controllers|guide:namespacedControllers] docs for more information.
Controller methods and GSP Tags which accept a controller name as a paramater now support an optional parameter indicating
that the controller is provided by a specific plugin.
{code:java}
<g:link controller="user" plugin="springSecurity">Manage Users</g:link>
{code}
{code:java}
class DemoController {
def index() {
redirect controller: 'user', action: 'list', plugin: 'springSecurity'
}
}
{code}
h4. Forked Tomcat Execution
Grails 2.2 supports forked JVM execution of the Tomcat container in development mode. This has several benefits including:
* Reduced memory consumption, since the Grails build system can exit
* Isolation of the build classpath from the runtime classpath
* The ability to deploy other Grails/Spring applications in parallels without conflicting dependencies
See the [documentation|guide:forkedMode] on using forked mode for more information.
h4. SQL Projections In Criteria Queries
Grails 2.2 adds new functionality to criteria queries to provide access to Hibernate's SQL projection API.
{code:java}
// Use SQL projections to retrieve the perimeter and area of all of the Box instances...
def c = Box.createCriteria()
def results = c.list {
projections {
sqlProjection '(2 * (width + height)) as perimiter, (width * height) as area', ['perimeter', 'area'], [INTEGER, INTEGER]
}
}
{code}
See the [Criteria|guide:criteria] section for more information.
h4. Groovy 2
Grails 2.2 ships with Groovy 2.0, which has a [bunch of new features|http://www.infoq.com/articles/new-groovy-20] itself.
Jump to Line
Something went wrong with that request. Please try again.