开发者

Griffon Gsql - how to config datasource in Config.properties file?

开发者 https://www.devze.com 2023-02-20 16:57 出处:网络
griffon gsql plugin\'s datasource config is write in Data开发者_如何学GoSource.groovy, and i want it to be in Config.properties, how?

griffon gsql plugin's datasource config is write in Data开发者_如何学GoSource.groovy, and i want it to be in Config.properties, how? i try, it don't work:

  1. add Config.properties at conf

2.config in Config.properties: dataSource.driverClassName=com.mysql.jdbc.Driver dataSource.url=jdbc:mysql://localhost/smp?useUnicode=true&characterEncoding=UTF8

3.remove this config from DataSource.groovy

it seems the gsql plugin must to read config from DataSource.groovy.

ps: is gsql plugin opensource?


sloved. ref to http://markmail.org/thread/gslnhxseaicc5ksp#query:+page:1+mid:beunoxesbbmlmznp+state:results

//read config.properties http://markmail.org/thread/gslnhxseaicc5ksp#query:+page:1+mid:beunoxesbbmlmznp+state:results
def props = new Properties()
props.load(getClass().classLoader.getResourceAsStream("Config.properties"))
def config = new ConfigSlurper().parse(props)

dataSource {
    dbCreate = "skip"
    pooled = config.dataSource.pooled as boolean
    //set this to true if using MySQL or any other RDBMS that requires execution of DDL statements on separate calls
    tokenizeddl = config.dataSource.tokenizeddl as boolean

    driverClassName = config.dataSource.driverClassName
    url = config.dataSource.url
    username = config.dataSource.username
    password = config.dataSource.password
}
0

精彩评论

暂无评论...
验证码 换一张
取 消