grails 代码中运行环境检测

1.添加引用

import grails.util.Environment;

2.检测

switch(Environment.current) {
        case Environment.DEVELOPMENT:
           log.info("Environment.DEVELOPMENT")
        break
        case Environment.PRODUCTION:
           log.info("Environment.PRODUCTION")
        break 
        }


你可能感兴趣的:(grails,import)