The resources (COM. ibatis. Common. Resource. *) resources class provides an easy-to-use method to load resources from the class path. Processing classloader is a challenging task, especially in the case of application servers/containers. The resources class tries to simplify this work. The resources class is often used in the following situations :? Load an SQL map configuration file, such as a sqlMap-config.xml, from the class path ).? Load the DaO Manager configuration file (such as Dao. XML) from the class path ).? Load various. properties files from the class path. There are many ways to load a resource, including :? For simple read-only text data, load as reader.? For simple read-only binary or text data, load as stream.? For binary or text files that can be read and written, load as file.? For Read-Only configuration Property Files, load as properties.? For read-only general resources, load as a URL. In the preceding order, the resources class can load resources as follows: reader getresourceasreader (string resource); stream getresourceasstream (string resource); file getresourceasfile (string resource ); properties getresourceasproperties (string resource); Url getresourceasurl (string resource); in each of the preceding methods, the same classloader is used to load resources and resources, or, if it fails, the system classloader will be used. In some environments (such as some application servers), classloader may be troublesome. You can specify the classloader used (such as the classloader used to load the application ). Each method above has a classloader as a parameter. They are: reader getresourceasreader (classloader, string resource); stream getresourceasstream (classloader, string resource); file category (classloader, string resource); properties getresourceasproperties (classloader, string Resource); Url getresourceasurl (classloader, string resource); the resource Parameter Name of the preceding method should be a fully qualified name, plus the full file/Resource Name. For example, if the class path contains the resource "com. domain. mypackage. mypropertiesfile. properties ",Code Loading http://www.ibatis.com Clinton begin translated by Liu Tao (toleu@21cn.com) Development Guide ibatis SQL maps page 59 of 62 resources for properties (note that a slash/is not required before the resource name /). String resource = "COM/domain/mypackage/mypropertiesfile. properties "; properties props = resources. getresourceasproperties (Resource); similarly, you can load the SQL map configuration file from the class path as a reader. Suppose it is in the properties directory of the class path (properties. sqlMap-config.xml ). String resource = "properties/sqlMap-config.xml"; reader = resources. getresourceasreader (Resource); sqlmapclient sqlmap = xmlsqlmapbuilder. buildsqlmap (Reader );