When you create a controller, it has a Transactional annotation on it, for example:
@Transactional(readOnly=true) class FooController { ..
If you delete the annotation (and annotations of any level), Grails will no longer connect to the database to start the transaction.
Open an In View session should not enter the game, since we use the lazy init approach to get a connection to OSIV
Please note that my answer above assumes you are using the latest version of Grails (2.3.x or higher)
Updated
For MongoDB, you can disable automatic connection for all controllers by specifying the following bean (which overrides the default value) in grails-app/conf/spring/resources.groovy :
mongoPersistenceInterceptor(org.codehaus.groovy.grails.support.NullPersistentContextInterceptor)
However, at the moment there is no way to disable based on each controller
source share