锘??xml version="1.0" encoding="utf-8" standalone="yes"?>yiren22亚洲综合,中文在线а√天堂,99这里只有久久精品视频http://www.aygfsteel.com/ybc/zh-cnWed, 18 Jun 2025 19:00:03 GMTWed, 18 Jun 2025 19:00:03 GMT60- 璇誨彇properties鏂囦歡鐨勭畝鍗曠ず渚?/title>http://www.aygfsteel.com/ybc/archive/2008/03/28/ybc080328.htmlybcybcFri, 28 Mar 2008 01:19:00 GMThttp://www.aygfsteel.com/ybc/archive/2008/03/28/ybc080328.htmlhttp://www.aygfsteel.com/ybc/comments/189180.htmlhttp://www.aygfsteel.com/ybc/archive/2008/03/28/ybc080328.html#Feedback0http://www.aygfsteel.com/ybc/comments/commentRss/189180.htmlhttp://www.aygfsteel.com/ybc/services/trackbacks/189180.htmlpackage ybc;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Properties;
public class GetFile {
private Properties userList;
public GetFile(String name,String password ) {//鏋勯犲嚱鏁?
super();
Logger log = Logger.getLogger(GetFile.class);
log.debug("鏋勯犲嚱鏁?);
userList=new Properties();
userList.setProperty(name,password);
}
public Properties getUserList() throws IOException
{
// 鍒ゆ柇 userList 鏄惁涓虹┖錛屽鏋滀負絀猴紝鍒欓噸鏂板姞杞藉睘鎬ф枃浠?
if (userList == null)
{
// 棣栧厛媯鏌ヤ繚瀛樼敤鎴峰悕銆佸瘑鐮佺殑灞炴ф枃浠舵槸鍚﹀瓨鍦?
File f = new File("d:/userFile.txt");
// 濡傛灉鏂囦歡涓嶅瓨鍦紝鍒欏垱寤烘枃浠?
System.out.print("鏂囦歡鐨勮礬寰?"+f.getAbsolutePath()+"\n");
if (!f.exists())
f.createNewFile();
// 鍒涘緩鏂扮殑 Properties 瀹炰緥錛岃瀹炰緥淇濆瓨浜嗙敤鎴峰悕銆佸瘑鐮佸
userList = new Properties();
// 浠庡睘鎬ф枃浠朵腑鍔犺澆鎵鏈夌殑鐢ㄦ埛鍚嶃佸瘑鐮?
userList.load(new FileInputStream(f));
}
// 榪斿洖淇濆瓨鐢ㄦ埛鍚嶃佸瘑鐮佸鐨?Properties 瀹炰緥
return userList;
}
public boolean saveUserList()throws IOException
{
// 濡傛灉鐢ㄦ埛鍒楄〃涓虹┖錛屽垯鏃犳硶淇濆瓨鐢ㄦ埛
if (userList == null)
{
return false;
}
// 璋冪敤 Properties 綾葷殑 store 鏂規硶灝嗙敤鎴峰垪琛ㄤ繚瀛樺埌鏂囦歡杈撳嚭嫻?
userList.store(new FileOutputStream("d:/userFile.txt"), "userList");
return true;
}
public static void main(String args[]){
System.out.println("鎵ц鐨勭涓姝ワ細淇濆瓨閿煎鍒版枃鏈枃浠朵腑");
GetFile g= new GetFile("ybc","ybc");
try{if(g.saveUserList())
System.out.print("save successfull!\n");
}catch(IOException e){
System.out.print(e.toString());
}
System.out.println("鎵ц鐨勭浜屾錛氬彇鏂囨湰鏂囦歡涓殑key瀵瑰簲鐨勫?);
//鐢ㄤ笅闈㈣繖涓被get Userlist
try{
g.userList=null;//榪欏彞涓嶅姞鐨勮瘽錛屽畠灝辨病鐪熸浠庢枃鏈枃浠朵腑鍙?涓嶄俊浣犺瘯璇曟敞閲婅繖鍙ワ紝鐒跺悗榪愯灝辯湅涓嶅埌鎵撳嵃鐨勬枃浠惰礬寰勪簡錛侊紒錛?
System.out.println("浠庢枃浠朵腑get鐨剈ser閿?ybc鐨勫鹼細"+g.getUserList().get("ybc")+" ");
}catch(IOException e){
System.out.print(e.toString());
}
}
// 閫氳繃涓婇潰鐨勬紨紺轟綘鍙互綆鍗曚簡瑙o細File銆丗ileOutputStream銆丗ileInputStream鍜孭roperties綾葷殑浣跨敤
// 浠ヤ笂鍙槸綆鍗曠殑婕旂ず浜嗕笅properties鏂囦歡鐨勮鍙栬繃紼嬶紝瑕佹繁鍏ヤ簡榪欎釜綾誨彲浠ュ弬鑰僯ava 鐨?Api鏂囨。
}

]]> - 鍒╃敤spring2.0+hibernate3.2鏉ュ仛涓猦bm2ddl鐨勭畝鍗曠ず渚?/title>http://www.aygfsteel.com/ybc/archive/2008/03/26/188769.htmlybcybcWed, 26 Mar 2008 07:34:00 GMThttp://www.aygfsteel.com/ybc/archive/2008/03/26/188769.htmlhttp://www.aygfsteel.com/ybc/comments/188769.htmlhttp://www.aygfsteel.com/ybc/archive/2008/03/26/188769.html#Feedback0http://www.aygfsteel.com/ybc/comments/commentRss/188769.htmlhttp://www.aygfsteel.com/ybc/services/trackbacks/188769.html榪愯鐜錛歟clipse3.2錛媘yeclispe5.1
鏁版嵁搴擄細mysql4.1
鏈嶅姟鏈燂細tomcat5.5
妗嗘灦錛歴pring2.0錛媓ibernate3.2
1銆傜涓姝ワ細鎶婄幆澧冩惌璧鋒潵錛屽緩涓獁ebproject欏圭洰
2銆傜浜屾錛氬緩涓畝鍗曠殑綾?
渚嬪錛?
package vo;
public class Student {
private int id;
private String name;
public Student(int id, String name) {
super();
this.id = id;
this.name = name;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
絎笁姝ワ細閰嶇疆hbm鏂囦歡
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="vo">
<!-- 姣忎釜 class 鍏冪礌鏄犲皠涓涓寔涔呭寲綾?-->
<class name="Student" table="student_table">
<!-- 鏄犲皠鏍囪瘑灞炴?-->
<id name="id">
<!-- 鎸囧畾涓婚敭鐢熸垚鍣ㄧ瓥鐣?-->
<generator class="identity"/>
</id>
<!-- 鏄犲皠 name -->
<property name="name"/>
</class>
</hibernate-mapping>
絎洓姝ワ細閰嶇疆applicationContext.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
<beans>
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
<property name="jdbcUrl" value="jdbc:mysql://localhost:3306/school"/>
<property name="driverClass" value="com.mysql.jdbc.Driver"/>
<property name="user" value="root"/>
<property name="password" value="1234"/>
<property name="maxPoolSize" value="40"/>
<property name="minPoolSize" value="1"/>
<property name="initialPoolSize" value="1"/>
<property name="maxIdleTime" value="20"/>
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="mappingResources">
<list>
<value>vo/student.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<prop key="show_sql">true</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="hibernate.jdbc.batch_size">20</prop>
</props>
</property>
</bean>
</beans>
絎簲姝ワ細閰嶇疆web.xml (娉細涓昏鏄負浜嗗姞杞絘pplicationContext.xml鑰岀敤鐨勶級
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
</web-app>
絎叚姝ワ細灝卞彲浠ュ彂甯冮」鐩拰榪愯tomcat錛岀劧鍚庡湪鏁版嵁搴撻噷灝卞彲浠ョ湅鍒板緩鎴愮殑student_table琛ㄤ簡錛屾槸涓嶆槸寰堢畝鍗曞晩錛屽懙鍛佃繖鍙槸涓畝鍗曠殑鍏ラ棬銆?
娉ㄦ剰錛?.鍦ㄦ暟鎹簱涓鍏堝緩濂絛atabase,鎴戣繖閲屾槸school
2.涓浜涘寘涓嶈蹇樿娣誨姞錛氬錛歛ntlr.jar,asm.jar,c3p0.jar,cglib.jar,commoons-beanutils.jar,commons-collection,jar
hibernate3.2.jar,jta.jar,mysql-connector.jar
spring-2.0.jar絳夌瓑
涓嬮潰鏄痩og4j浜х敓鐨勮繍琛屼俊鎭細
2008-03-26 14:49:35,796 INFO [main] context.ContextLoader (ContextLoader.java:174) - Root WebApplicationContext: initialization started
2008-03-26 14:49:35,796 INFO [main] core.ApplicationContext (ApplicationContext.java:646) - Loading Spring root WebApplicationContext
2008-03-26 14:49:36,156 INFO [main] core.CollectionFactory (CollectionFactory.java:76) - JDK 1.4+ collections available
2008-03-26 14:49:36,187 INFO [main] core.CollectionFactory (CollectionFactory.java:80) - Commons Collections 3.x available
2008-03-26 14:49:36,390 INFO [main] xml.XmlBeanDefinitionReader (XmlBeanDefinitionReader.java:347) - Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml]
2008-03-26 14:49:36,734 INFO [main] support.AbstractRefreshableApplicationContext (AbstractRefreshableApplicationContext.java:100) - Bean factory for application context [Root WebApplicationContext]: org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [dataSource,sessionFactory]; root of BeanFactory hierarchy
2008-03-26 14:49:36,812 INFO [main] support.AbstractApplicationContext (AbstractApplicationContext.java:324) - 2 beans defined in application context [Root WebApplicationContext]
2008-03-26 14:49:36,937 INFO [main] support.AbstractApplicationContext (AbstractApplicationContext.java:475) - Unable to locate MessageSource with name 'messageSource': using default [org.springframework.context.support.DelegatingMessageSource@105fa26]
2008-03-26 14:49:36,953 INFO [main] support.AbstractApplicationContext (AbstractApplicationContext.java:497) - Unable to locate ApplicationEventMulticaster with name 'applicationEventMulticaster': using default [org.springframework.context.event.SimpleApplicationEventMulticaster@f90137]
2008-03-26 14:49:37,078 INFO [main] support.UiApplicationContextUtils (UiApplicationContextUtils.java:83) - Unable to locate ThemeSource with name 'themeSource': using default [org.springframework.ui.context.support.ResourceBundleThemeSource@e38fca]
2008-03-26 14:49:37,093 INFO [main] support.DefaultListableBeanFactory (DefaultListableBeanFactory.java:278) - Pre-instantiating singletons in factory [org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [dataSource,sessionFactory]; root of BeanFactory hierarchy]
2008-03-26 14:49:37,218 INFO [main] log.MLog (MLog.java:80) - MLog clients using log4j logging.
2008-03-26 14:49:37,546 INFO [main] c3p0.C3P0Registry (C3P0Registry.java:204) - Initializing c3p0-0.9.1.2 [built 21-May-2007 15:04:56; debug? true; trace: 10]
2008-03-26 14:49:38,296 INFO [main] cfg.Environment (Environment.java:500) - Hibernate 3.2.0
2008-03-26 14:49:38,343 INFO [main] cfg.Environment (Environment.java:533) - hibernate.properties not found
2008-03-26 14:49:38,343 INFO [main] cfg.Environment (Environment.java:667) - Bytecode provider name : cglib
2008-03-26 14:49:38,359 INFO [main] cfg.Environment (Environment.java:584) - using JDK 1.4 java.sql.Timestamp handling
2008-03-26 14:49:39,390 INFO [main] cfg.HbmBinder (HbmBinder.java:300) - Mapping class: vo.Student -> student_table
2008-03-26 14:49:39,562 INFO [main] hibernate3.LocalSessionFactoryBean (LocalSessionFactoryBean.java:738) - Building new Hibernate SessionFactory
2008-03-26 14:49:39,937 INFO [main] connection.ConnectionProviderFactory (ConnectionProviderFactory.java:72) - Initializing connection provider: org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider
2008-03-26 14:49:40,203 INFO [main] impl.AbstractPoolBackedDataSource (AbstractPoolBackedDataSource.java:462) - Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, dataSourceName -> 1hge1277s1svuo9rknctg8|856d3b, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> com.mysql.jdbc.Driver, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 1hge1277s1svuo9rknctg8|856d3b, idleConnectionTestPeriod -> 0, initialPoolSize -> 1, jdbcUrl -> jdbc:mysql://localhost:3306/school, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 20, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 40, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 1, numHelperThreads -> 3, numThreadsAwaitingCheckoutDefaultUser -> 0, preferredTestQuery -> null, properties -> {user=******, password=******}, propertyCycle -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, usesTraditionalReflectiveProxies -> false ]
2008-03-26 14:49:40,781 INFO [main] cfg.SettingsFactory (SettingsFactory.java:81) - RDBMS: MySQL, version: 4.1.7-nt
2008-03-26 14:49:40,781 INFO [main] cfg.SettingsFactory (SettingsFactory.java:82) - JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-3.1.13 ( $Date: 2005-11-17 15:53:48 +0100 (Thu, 17 Nov 2005) $, $Revision$ )
2008-03-26 14:49:40,906 INFO [main] dialect.Dialect (Dialect.java:141) - Using dialect: org.hibernate.dialect.MySQLDialect
2008-03-26 14:49:40,937 INFO [main] transaction.TransactionFactoryFactory (TransactionFactoryFactory.java:31) - Using default transaction strategy (direct JDBC transactions)
2008-03-26 14:49:40,953 INFO [main] transaction.TransactionManagerLookupFactory (TransactionManagerLookupFactory.java:33) - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
2008-03-26 14:49:40,953 INFO [main] cfg.SettingsFactory (SettingsFactory.java:134) - Automatic flush during beforeCompletion(): disabled
2008-03-26 14:49:40,953 INFO [main] cfg.SettingsFactory (SettingsFactory.java:138) - Automatic session close at end of transaction: disabled
2008-03-26 14:49:40,953 INFO [main] cfg.SettingsFactory (SettingsFactory.java:145) - JDBC batch size: 20
2008-03-26 14:49:40,953 INFO [main] cfg.SettingsFactory (SettingsFactory.java:148) - JDBC batch updates for versioned data: disabled
2008-03-26 14:49:40,968 INFO [main] cfg.SettingsFactory (SettingsFactory.java:153) - Scrollable result sets: enabled
2008-03-26 14:49:40,968 INFO [main] cfg.SettingsFactory (SettingsFactory.java:161) - JDBC3 getGeneratedKeys(): enabled
2008-03-26 14:49:40,968 INFO [main] cfg.SettingsFactory (SettingsFactory.java:169) - Connection release mode: on_close
2008-03-26 14:49:40,968 INFO [main] cfg.SettingsFactory (SettingsFactory.java:193) - Maximum outer join fetch depth: 2
2008-03-26 14:49:40,968 INFO [main] cfg.SettingsFactory (SettingsFactory.java:196) - Default batch fetch size: 1
2008-03-26 14:49:40,968 INFO [main] cfg.SettingsFactory (SettingsFactory.java:200) - Generate SQL with comments: disabled
2008-03-26 14:49:40,968 INFO [main] cfg.SettingsFactory (SettingsFactory.java:204) - Order SQL updates by primary key: disabled
2008-03-26 14:49:40,968 INFO [main] cfg.SettingsFactory (SettingsFactory.java:369) - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
2008-03-26 14:49:41,000 INFO [main] ast.ASTQueryTranslatorFactory (ASTQueryTranslatorFactory.java:24) - Using ASTQueryTranslatorFactory
2008-03-26 14:49:41,000 INFO [main] cfg.SettingsFactory (SettingsFactory.java:212) - Query language substitutions: {}
2008-03-26 14:49:41,000 INFO [main] cfg.SettingsFactory (SettingsFactory.java:217) - JPA-QL strict compliance: disabled
2008-03-26 14:49:41,000 INFO [main] cfg.SettingsFactory (SettingsFactory.java:222) - Second-level cache: enabled
2008-03-26 14:49:41,000 INFO [main] cfg.SettingsFactory (SettingsFactory.java:226) - Query cache: disabled
2008-03-26 14:49:41,000 INFO [main] cfg.SettingsFactory (SettingsFactory.java:356) - Cache provider: org.hibernate.cache.NoCacheProvider
2008-03-26 14:49:41,000 INFO [main] cfg.SettingsFactory (SettingsFactory.java:241) - Optimize cache for minimal puts: disabled
2008-03-26 14:49:41,000 INFO [main] cfg.SettingsFactory (SettingsFactory.java:250) - Structured second-level cache entries: disabled
2008-03-26 14:49:41,062 INFO [main] cfg.SettingsFactory (SettingsFactory.java:277) - Statistics: disabled
2008-03-26 14:49:41,062 INFO [main] cfg.SettingsFactory (SettingsFactory.java:281) - Deleted entity synthetic identifier rollback: disabled
2008-03-26 14:49:41,062 INFO [main] cfg.SettingsFactory (SettingsFactory.java:296) - Default entity-mode: pojo
2008-03-26 14:49:41,203 INFO [main] impl.SessionFactoryImpl (SessionFactoryImpl.java:161) - building session factory
2008-03-26 14:49:41,781 INFO [main] tuple.PojoInstantiator (PojoInstantiator.java:61) - no default (no-argument) constructor for class: vo.Student (class must be instantiated by Interceptor)
2008-03-26 14:49:42,937 INFO [main] impl.SessionFactoryObjectFactory (SessionFactoryObjectFactory.java:82) - Not binding factory to JNDI, no JNDI name configured
2008-03-26 14:49:42,968 INFO [main] hbm2ddl.SchemaUpdate (SchemaUpdate.java:115) - Running hbm2ddl schema update
2008-03-26 14:49:42,968 INFO [main] hbm2ddl.SchemaUpdate (SchemaUpdate.java:126) - fetching database metadata
2008-03-26 14:49:43,000 INFO [main] hbm2ddl.SchemaUpdate (SchemaUpdate.java:138) - updating schema
2008-03-26 14:49:43,031 INFO [main] hbm2ddl.DatabaseMetadata (DatabaseMetadata.java:91) - table not found: student_table
2008-03-26 14:49:43,031 INFO [main] hbm2ddl.DatabaseMetadata (DatabaseMetadata.java:91) - table not found: student_table
2008-03-26 14:49:43,421 INFO [main] hbm2ddl.SchemaUpdate (SchemaUpdate.java:160) - schema update complete
2008-03-26 14:49:43,546 INFO [main] context.ContextLoader (ContextLoader.java:189) - Using context class [org.springframework.web.context.support.XmlWebApplicationContext] for root WebApplicationContext
2008-03-26 14:49:43,578 INFO [main] context.ContextLoader (ContextLoader.java:199) - Root WebApplicationContext: initialization completed in 7782 ms

]]>
主站蜘蛛池模板:
增城市|
德州市|
保德县|
若尔盖县|
左权县|
扶余县|
宜州市|
湟中县|
青浦区|
白沙|
南陵县|
枝江市|
贵港市|
边坝县|
平遥县|
鄂伦春自治旗|
陵川县|
武邑县|
浦东新区|
怀仁县|
漳州市|
锡林郭勒盟|
长泰县|
陈巴尔虎旗|
辽宁省|
安新县|
湟源县|
津市市|
柳河县|
瑞丽市|
黑河市|
洛隆县|
右玉县|
会昌县|
汉中市|
新疆|
枝江市|
汉阴县|
沧州市|
庄河市|
全南县|