zoukankan      html  css  js  c++  java
  • Java Instrumentation

    package com.dms;
    
    import java.io.File;
    
    import org.apache.commons.io.FileUtils;
    import org.javalite.activejdbc.Base;
    import org.javalite.instrumentation.Instrumentation;
    
    import com.dms.manage.domains.PO.basedata.OrgPo;
    
    public class MakeInstrumentationUtil {
    
        public static void make() {
            try {
                String resourcePath = ClassLoader.getSystemResource("").getPath();
                Instrumentation instrumentation = new Instrumentation();
                instrumentation.setOutputDirectory(resourcePath);
                instrumentation.instrument();
                
                File properties = new File(resourcePath + "\activejdbc_models.properties");
                if(properties.exists()) {
                    File target = new File(System.getProperty("user.dir") + "\res\activejdbc_models.properties");
                    FileUtils.copyFile(properties, target);
                }else {
                    System.out.println("properties未成功生成。");
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    
        public static void main(String[] args) {
            MakeInstrumentationUtil.make(); // 这里创建Instrumentation
        }
    }

    web.xml
    <listener>
    <listener-class>org.javalite.instrumentation.ActiveJdbcInstrumentationListener</listener-class>
    </listener>

  • 相关阅读:
    sql
    java常见异常
    call的用法及NodeList与Array的区别
    os模块
    random模块
    time模块
    序列化模块
    模块介绍
    内置函数
    匿名函数-lambda
  • 原文地址:https://www.cnblogs.com/MaxLife/p/9002384.html
Copyright © 2011-2022 走看看