我正在尝试遵循示例Ratpacked: Using PostgreSQL Database,但'of' in 'ratpack.config.ConfigData' can not be applied to '(groovy.lang.Closure<ratpack.config.ConfigDataBuilder>)'
在 IntelliJ IDEA 中出现错误。
ratpack {
bindings {
// Create generic configuration.
final ConfigData configData = ConfigData.of { ConfigDataBuilder builder ->
// Set configuration properties.
// We can use the yaml, json and other
// ConfigDataBuilder methods to read
// configuration from other sources.
builder.props(
['postgres.user' : 'postgres',
'postgres.password' : 'secret',
'postgres.portNumber' : 5432,
'postgres.databaseName': 'postgres',
'postgres.serverName' : '192.168.99.100'])
builder.build()
}
// Create instance of PostgresConfig
// that is used for the
// configurable module PostgresModule.
bindInstance PostgresConfig, configData.get('/postgres', PostgresConfig)
// Initialise module to create DataSource.
module PostgresModule
// Initialize SqlModule to provide
// Groovy SQL support in our application.
module SqlModule
}
}