You can do `EntitySpec.create(MyService.class).configure(BrooklynConfigKeys.BROOKLYN_DATA_DIR, "/tmp/brooklyn-foo")` to avoid the need for casting to subsequently call `setConfig`.