Analyzing your code with CodeNarc

CodeNarc analyzes Groovy code for defects, bad practices, inconsistencies, style issues and more. A flexible framework for rules, rulesets and custom rules means it’s easy to configure CodeNarc to fit into your project. Build tool, framework support, and report generation are all enterprise ready. This is the description you find on the CodeNarc home page:… Continue reading Analyzing your code with CodeNarc

Logging from a library

I sometimes create libraries with less overhead than the e.g. a grails plugin. Applying the same logging as grails is done with these steps: add dependencies add configuration files for testing build.gradle: Then create the src/test/resources directory: In this case I configured test logging with logback-test.xml. For some reason I could not make logback-test.groovy work.… Continue reading Logging from a library

Logging from tests

Following up on the logging blog post. When creating and later running tests it could be equally helpful with some good logs. Configuring test logging is done with either logback-test.groovy or logback-test.xml which should be placed in the resources directory within the test directory. logback-test.groovy And then setting up the integration test something like: @Slf4j… Continue reading Logging from tests


Grails logging is described in the docs: Grails logging is built on top of logback: Why/What log? In development and testing I use logs as a supplement to debuggers. The logging is configured to be more verbose. In production debugging is not available, so logging is your tool for investigating a situation and… Continue reading Logging

Spring security core with groups

In this blog post I will look into assigning roles through groups. Group assignment becomes more interesting with: increasing user count increasing role count users with similar access needs Overview There are three basic domains when configuring spring security for groups. User Role RoleGroup We also have these many-to-many helper domains: Each user can be… Continue reading Spring security core with groups

Making SystemPropertyTenantResolver work

I use SystemPropertyTenantResolver for testing purposes. One use-case is building a simple app to see how some aspects of multitenancy works. The other use-case is testing with Spock. Minimum necessary code to setup multitenancy and select one tenant. First in application.yml enable multitenancy. Then in application.yml define datasources for each tenant. In this example the… Continue reading Making SystemPropertyTenantResolver work

Security – authentication

In this blog post I will look into authentication. XPages has a built-in authentication mechanism. In order to enable authentication I edited the application’s ACL, removing anonymous access and adding the appropriate users / groups. Grails does not have built-in authentication. The documentation chapter on Authentication describes how to implement your own authentication using interceptors,… Continue reading Security – authentication

Selecting a database platform

Grails database access is provided through GORM which implements connections to many different database platforms. The main implementation of is for Hiberate ORM which uses JDBC to connect to a relational database. There are also GORM implementations for MongoDB, Neo4j, Cassandra and REST. Given support for JDBC and the special implementations you have a rich… Continue reading Selecting a database platform