This is the config. Properties
#DataBase ConfigKJJF.driverClassName=oracle.jdbc.OracleDriverKJJF.databaseURL=jdbc:oracle:thin:@192.168.31.1:1521:zfpay1KJJF.username=ecfront
Package COM. jadyer. util; import Java. io. ioexception; import Java. util. properties;/*** Configuration File Reading tool * @ author http://blog.csdn/net/jadyer * @ version V1.0 * @ editime Jun 7, 2012 5:30:10 * @ created Jun 7, 2012 5:30:10 pm */public class configutil {private properties config;/*** internal class implementation Singleton * @ see can achieve delayed loading and reduce memory overhead, no multithreading problem * @ see is a Class-level internal class, that is, a static member internal class, the instance of this internal class is not bound to the instance of the external class * @ see and will be loaded only when called, this achieves delayed loading */Private Static class singletonholder {// static initializer. JVM ensures thread security. Private Static configutil instance = new configutil ();} /*** get the Instance Object of configutil * @ see when this method is called for the first time, it reads singletonholder for the first time. instance, causing the singletonholder class to be initialized * @ see, while the singletonholder class will initialize its static domain when it is loaded and initialized, to create a configutil instance * @ see because it is a static domain, it will only be initialized once when the VM loads the class, and the virtual machine to ensure its thread security * @ see the advantage of this mode is that the getinstance () method is not synchronized and only executes access to a domain, therefore, delayed initialization does not increase any access costs * @ author http://blog.csdn/net/jadyer * @ create Jun 7, 2012 7:22:24 */public static configutil getinstance () {return singletonholder. instance;}/*** cloning method * @ see prohibit creating a new object by cloning */@ overridepublic configutil clone () {return getinstance ();} private configutil () {Config = new properties (); try {config. load (configutil. class. getresourceasstream ("/config. properties ");} catch (ioexception e) {system. out. println ("load/config. properties error .... "); E. printstacktrace (); throw new exceptionininitializererror ("failed to load the system configuration file .... ") ;}} Public String getproperty (string key) {return config. getproperty (key);} Public String getproperty (string key, string defaultvalue) {return config. getproperty (Key, defaultvalue);} public int getpropertyforint (string key) {return integer. valueof (config. getproperty (key )). intvalue ();} public int getpropertyforint (string key, string defaultvalue) {return integer. valueof (config. getproperty (Key, defaultvalue )). intvalue ();}}