鏈〉鍙湁灝辨槸鏈彞.
锘??xml version="1.0" encoding="utf-8" standalone="yes"?>
]]>
2.瀵煎叆jar鍖咃紙渚嬪錛宭og4j-1.2.15.jar,slf4j-api-1.5.2.jar,slf4j-log4j12-1.5.0.jar錛夎闄勪歡錛?a href="/Files/ZouYonghui/log4j.rar">/Files/ZouYonghui/log4j.rar
3.鍦╯rc鐩綍涓嬬紪鍐檒og.properties鏂囦歡錛岄噷闈㈠寘鍚棩蹇楁墍鍦ㄤ綅緗紝濡備笅鎵紺猴細(xì)
#Created by JInto - www.guh-software.de
#Mon May 27 17:12:29 CST 2013
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.ImmediateFlush=true
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=[%p] %d{dd MMM hh\:mm\:ss.SSS aa} %t %m%n
log4j.appender.logFile=org.apache.log4j.RollingFileAppender
log4j.appender.logFile.Append=true
log4j.appender.logFile.File=D\:/Java/logs/testHell
og4j.appender.logFile.MaxBackupIndexloWorld.log=100
log4j.appender.logFile.MaxFileSize=10MB
log4j.appender.logFile.layout=org.apache.log4j.PatternLayout
log4j.appender.logFile.layout.ConversionPattern=[%p] %d{dd MMM hh\:mm\:ss.SSS aa} %t %m%n
log4j.appender.FILELOGER.encoding=UTF-8
log4j.logger.com.mchange=ERROR
log4j.logger.net.sf.ehcache=ERROR
log4j.logger.org.apache.commons=ERROR
log4j.logger.org.apache.cxf=info
log4j.logger.org.apache.http=ERROR
log4j.logger.org.apache.shiro=ERROR
log4j.logger.org.hibernate=ERROR
log4j.logger.org.springframework=ERROR
log4j.rootLogger=info,logFile,CONSOLE
PropertyConfigurator.configure("log4j.properties");
5.浣跨敤
濡傦細(xì)
private static final Logger log = LoggerFactory.getLogger(HelloWorld.class);
銆傘傘傘傘傘?br />log.debug("hello");
]]>
]]>
鍘熷洜1錛岃繖涓儏鍐墊湁鏃跺欐槸jar鍖呬腑緙哄皯闇瑕佺殑綾伙紝娌℃妸闇瑕佺殑綾繪墦榪涘幓
鍘熷洜2錛?span style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,244,224); text-indent: 32px; letter-spacing: normal; display: inline !important; font: 16px/28px 'Hiragino Sans GB W3', 'Hiragino Sans GB', Arial, Helvetica, simsun, u5b8bu4f53; white-space: normal; orphans: 2; float: none; color: rgb(83,61,37); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">緙哄皯default.properties鏂囦歡
浠庡叾浠栧伐紼嬫嫹璐濅竴涓繃鏉?/span>
鍘熷洜3錛?span style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,244,224); text-indent: 32px; letter-spacing: normal; display: inline !important; font: 16px/28px 'Hiragino Sans GB W3', 'Hiragino Sans GB', Arial, Helvetica, simsun, u5b8bu4f53; white-space: normal; orphans: 2; float: none; color: rgb(83,61,37); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">娌℃湁jar鍖咃紝娌℃湁璧勬簮鏂囦歡
宸ョ▼鍙抽敭 -> Properties ->android ->閫夋嫨涓涓猘ndroid鐨勭増鏈紝錛堝鏋滃凡緇忛夋嫨濂戒簡(jiǎn)錛岃繕鏄湁闂錛屽氨鍏堥夋嫨鍙︿竴涓紝涔嬪悗鍐嶆崲鍥炴潵錛?/span>
]]>
java.lang.NoClassDefFoundError: org/apache/commons/collections/map/LRUMap
at org.hibernate.util.SimpleMRUCache.init(SimpleMRUCache.java:71)
at org.hibernate.util.SimpleMRUCache.<init>(SimpleMRUCache.java:55)
at org.hibernate.engine.query.QueryPlanCache.<init>(QueryPlanCache.java:76)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:239)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1872)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:906)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:57)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:63)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:47)
at com.rfcyber.rfcepayment.util.jpa.JPAHelper.init(Unknown Source)
at test.TestDataPreparation.setUp(TestDataPreparation.java:52)
at junit.framework.TestCase.runBare(TestCase.java:128)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:120)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.collections.map.LRUMap
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
... 22 more
2.緙簀ta.jar
java.lang.NoClassDefFoundError: javax/transaction/SystemException
at org.hibernate.ejb.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:112)
at org.hibernate.ejb.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:107)
at com.rfcyber.rfcepayment.util.jpa.JPAHelper.getEntityManager(Unknown Source)
at com.rfcyber.rfcepayment.util.jpa.JPADAO.findByJPQL(Unknown Source)
at com.richhouse.personal.service.DPZYTService.searchNextAvaiable(Unknown Source)
at com.richhouse.personal.util.ZYTDPHandler.searchNextAvaiable(Unknown Source)
at com.richhouse.personal.util.ZYTDataPreparation.prepareStoreData(Unknown Source)
at test.TestDataPreparation.testOracleSearchNext(TestDataPreparation.java:91)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at junit.framework.TestCase.runTest(TestCase.java:164)
at junit.framework.TestCase.runBare(TestCase.java:130)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:120)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.ClassNotFoundException: javax.transaction.SystemException
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
... 24 more
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "<!ENTITY contextInclude SYSTEM "org/springframework/web/context/WEB-INF/contextInclude.xml">
]>
<beans>
<import resource="classpath*:com/zyh/web/controller/spring/springAnnotation-import.xml"/>
</beans>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "<!ENTITY contextInclude SYSTEM "org/springframework/web/context/WEB-INF/contextInclude.xml">
]>
<beans>
<bean id="userDao" class="com.zyh.web.controller.dao.UserDAO">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<bean id="userManagerBase" class="com.zyh.web.controller.service.UserManager">
<property name="userDao" ref="userDao"></property>
</bean>
<bean id="userManager" parent="transactionBese">
<property name="target" ref="userManagerBase"></property>
</bean>
</beans>
瀵瑰簲鍏充簬灝卞凡緇忛厤緗湪瀹瑰櫒閲岄潰浜?jiǎn)銆?br />錛?.1錛夋煡鐪媠pringAnnotation-hibernate.xml錛堥厤緗暟鎹簮錛宻essionFactory錛屽拰浜嬬墿錛?br />
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "<!ENTITY contextInclude SYSTEM "org/springframework/web/context/WEB-INF/contextInclude.xml">
]>
<beans>
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost/test1?useUnicode=true"/>
<property name="username" value="root"/>
<property name="password" value="root"/>
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hiberante.format_sql">true</prop>
</props>
</property>
<property name="configLocations">
<list>
<value>
classpath*:com/zyh/web/controller/hibernate/hibernate.cfg.test.xml
</value>
</list>
</property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<bean id="transactionBese" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean" lazy-init="true" abstract="true">
<property name="transactionManager" ref="transactionManager"></property>
<property name="transactionAttributes">
<props>
<prop key="add*">PROPAGATION_REQUIRED,-Exception</prop>
<prop key="update*">PROPAGATION_REQUIRED,-Exception</prop>
<prop key="insert*">PROPAGATION_REQUIRED,-Exception</prop>
<prop key="modify*">PROPAGATION_REQUIRED,-Exception</prop>
<prop key="delete*">PROPAGATION_REQUIRED,-Exception</prop>
<prop key="get*">PROPAGATION_NEVER</prop>
</props>
</property>
</bean>
</beans>
閰嶇疆鐨勫搴旂殑 classpath*:com/zyh/web/controller/hibernate/hibernate.cfg.test.xml
錛?錛塻pringAnnotation-servlet.xml錛屽唴瀹瑰涓?br />
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=" xmlns:context=" xmlns:p=" xmlns:mvc=" xmlns:xsi=" xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/mvc
<!-- 娉ㄨВ鎵弿鍖?-->
<context:component-scan base-package="com.zyh.web.controller" />
<!-- 寮鍚敞瑙?-->
<mvc:annotation-driven/>
<!-- <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" />
<bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping"></bean> -->
<!-- 闈?rùn)鎬佽祫婧愯闂?-->
<mvc:resources location="/img/" mapping="/img/**"/>
<mvc:resources location="/js/" mapping="/js/**"/>
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/"></property>
<property name="suffix" value=".jsp"></property>
</bean>
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<property name="defaultEncoding" value="utf-8" />
<property name="maxUploadSize" value="10485760000" />
<property name="maxInMemorySize" value="40960" />
</bean>
</beans>
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=" xmlns:context=" xmlns:p=" xmlns:mvc=" xmlns:xsi=" xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/mvc
<!-- 娉ㄨВ鎵弿鍖?-->
<context:component-scan base-package="com.zyh.web.controller" />
<!-- 寮鍚敞瑙?-->
<mvc:annotation-driven/>
<!-- <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" />
<bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping"></bean> -->
<!-- 闈?rùn)鎬佽祫婧愯闂?-->
<mvc:resources location="/img/" mapping="/img/**"/>
<mvc:resources location="/js/" mapping="/js/**"/>
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/"></property>
<property name="suffix" value=".jsp"></property>
</bean>
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<property name="defaultEncoding" value="utf-8" />
<property name="maxUploadSize" value="10485760000" />
<property name="maxInMemorySize" value="40960" />
</bean>
</beans>
springAnnotation-hibernate.xml<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "<!ENTITY contextInclude SYSTEM "org/springframework/web/context/WEB-INF/contextInclude.xml">
]>
<beans>
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost/test1?useUnicode=true"/>
<property name="username" value="root"/>
<property name="password" value="root"/>
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hiberante.format_sql">true</prop>
</props>
</property>
<property name="configLocations">
<list>
<value>
classpath*:com/zyh/web/controller/hibernate/hibernate.cfg.test.xml
</value>
</list>
</property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<bean id="transactionBese" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean" lazy-init="true" abstract="true">
<property name="transactionManager" ref="transactionManager"></property>
<property name="transactionAttributes">
<props>
<prop key="add*">PROPAGATION_REQUIRED,-Exception</prop>
<prop key="update*">PROPAGATION_REQUIRED,-Exception</prop>
<prop key="insert*">PROPAGATION_REQUIRED,-Exception</prop>
<prop key="modify*">PROPAGATION_REQUIRED,-Exception</prop>
<prop key="delete*">PROPAGATION_REQUIRED,-Exception</prop>
<prop key="get*">PROPAGATION_NEVER</prop>
</props>
</property>
</bean>
</beans>
榪欎釜鍐欑殑鏈夌偣涔憋紝鐞嗘竻鎬濊礬錛屽叾瀹炲緢綆鍗曪紝灝辨槸閰嶇疆spring瀹瑰櫒,閲岄潰鎵弿浜?jiǎn)鎵鏈夌殑bean鍙?qiáng)涓浜涗緷璧栧叧緋伙紝hibernate閰嶇疆鏁版嵁婧愬緩绔嬫暟鎹簱榪炴帴錛孲essionFactory鐢ㄤ簬綆$悊鏁版嵁搴擄紝榪樻湁灝辨槸Springmvc鐢ㄤ簬鎺у埗瑙嗗浘涓庡悗鍙頒箣闂寸殑欏甸潰杞悜錛屼紶閫掓暟鎹紝鍙戦佽姹傘?br />閰嶇疆宸ヤ綔灝卞埌姝ょ粨鏉燂紝鐒跺悗灝辨槸鍐檅ean,dao,service,control涓庤仈緋婚厤緗枃浠剁殑瀵瑰簲鍏崇郴錛屽疄闄呭紑鍙戜腑褰撶劧涓嶄細(xì)鎶婇厤緗枃浠墮兘鍐欏ソ鎵嶆潵鍐檍ava浠g爜銆傛垜鐨勫仛娉曟槸鍚屾椂榪涜錛屾紡浜?jiǎn)灏辩浉搴旂殑鍔犱笂銆?br />
-----------------------------------------------------------3瀵瑰簲鐨勫疄鐜?-------------------------------------
3.1 涓轟簡(jiǎn)綆鍗曪紝鎴戜滑寤虹珛涓涓崟琛ㄧ殑娣誨垹鏀規(guī)煡錛屽氨涓涓璞″惂User錛屽搴旂殑琛═_User,閲岄潰鏈塽serName鍜宎ge涓や釜灞炴э紝褰撶劧榪樿寤虹珛涓涓富閿甶d,濡備笅鍒椾唬鐮佹墍紺?
com.zyh.web.controller.entity.User
package com.zyh.web.controller.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
@Entity
@Table(name="T_USER")
public class User {
@GeneratedValue(generator = "system-uuid")
@GenericGenerator(name = "system-uuid", strategy = "uuid")
@Column(length=32)
@Id
private String id;
@Column(length=32)
private String userName;
@Column(length=32)
private String age;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getAge() {
return age;
}
public void setAge(String age) {
this.age = age;
}
}
3.2 dao灞傜粨鏋勫涓嬶細(xì)鎺ュ彛IUserDAO涓庡疄鐜扮被UserDAO錛屾垜浠疄鐜版坊鍒犳敼鏌ワ紝鏌ヨ鍖呮嫭涓涓猆ser鍜屾墍浠ser
com.zyh.web.controller.dao.IUserDAO
package com.zyh.web.controller.dao;
import java.util.List;
import com.zyh.web.controller.entity.User;
public interface IUserDAO {
public void addUser(User user);
public List<User> getAllUser();
public User getUser(String id);
public boolean delUser(String id);
public boolean updateUser(User user);
}
瀹炵幇綾籙serDAO:
package com.zyh.web.controller.dao;
import java.util.List;
import org.hibernate.Query;
import org.hibernate.SessionFactory;
import com.zyh.web.controller.entity.User;
public class UserDAO implements IUserDAO {
private SessionFactory sessionFactory;
public void setSessionFactory(SessionFactory sessionFactory) {
this.sessionFactory = sessionFactory;
}
@Override
public void addUser(User user) {
// TODO Auto-generated method stub
sessionFactory.getCurrentSession().save(user);
}
@Override
public List<User> getAllUser() {
// TODO Auto-generated method stub
String hql = "from User";
Query query = sessionFactory.getCurrentSession().createQuery(hql);
return query.list();
}
@Override
public User getUser(String id) {
// TODO Auto-generated method stub
String hql = "from User u where u.id=?";
Query query = sessionFactory.getCurrentSession().createQuery(hql);
query.setString(0, id);
return (User) query.uniqueResult();
}
@Override
public boolean delUser(String id) {
// TODO Auto-generated method stub
String hql = "delete User u where u.id=?";
Query query = sessionFactory.getCurrentSession().createQuery(hql);
query.setString(0, id);
return (query.executeUpdate()>0);
}
@Override
public boolean updateUser(User user) {
// TODO Auto-generated method stub
String hql = "update User u set u.userName=?,u.age=? where u.id=?";
Query query = sessionFactory.getCurrentSession().createQuery(hql);
query.setString(0, user.getUserName());
query.setString(1, user.getAge());
query.setString(2, user.getId());
return (query.executeUpdate()>0);
}
}
3.3 service灞傜粨鏋勫涓嬶細(xì)鎺ュ彛IUserManager涓庡疄鐜扮被UserManager錛屾垜浠疄鐜版坊鍒犳敼鏌ワ紝鏌ヨ鍖呮嫭涓涓猆ser鍜屾墍浠ser
com.zyh.web.controller.service.IUserManager
package com.zyh.web.controller.service;
import java.util.List;
import com.zyh.web.controller.entity.User;
public interface IUserManager {
public void addUser(User user);
public List<User> getAllUser();
public boolean delUser(String id);
public User getUser(String id);
public boolean updateUser(User user);
}
瀹炵幇綾籙serManager.java
package com.zyh.web.controller.service;
import java.util.List;
import com.zyh.web.controller.dao.IUserDAO;
import com.zyh.web.controller.entity.User;
public class UserManager implements IUserManager {
private IUserDAO userDao;
public void setUserDao(IUserDAO userDao) {
this.userDao = userDao;
}
@Override
public void addUser(User user) {
// TODO Auto-generated method stub
userDao.addUser(user);
}
@Override
public List<User> getAllUser() {
// TODO Auto-generated method stub
return userDao.getAllUser();
}
@Override
public boolean delUser(String id) {
// TODO Auto-generated method stub
return userDao.delUser(id);
}
@Override
public User getUser(String id) {
// TODO Auto-generated method stub
return userDao.getUser(id);
}
@Override
public boolean updateUser(User user) {
// TODO Auto-generated method stub
return userDao.updateUser(user);
}
}
4.Control灞傜粨鏋勫涓嬶細(xì)瀹炵幇綾籙serController.java錛屼唬鐮佸涓嬶細(xì)
package com.zyh.web.controller;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.zyh.web.controller.entity.User;
import com.zyh.web.controller.service.IUserManager;
@Controller
@RequestMapping("/user")
public class UserController {
@Resource(name="userManager")
private IUserManager userManager;
@RequestMapping("/toAddUser")
public String toAddUser(){
return "/addUser";
}
@RequestMapping("/addUser")
public String addUser(User user){
userManager.addUser(user);
return "redirect:/user/getAllUser";
}
@RequestMapping("/getAllUser")
public String getAllUser(HttpServletRequest request){
List<User> user = userManager.getAllUser();
request.setAttribute("user", user);
return "/userManager";
}
@RequestMapping("/delUser")
public void delUser(String id,HttpServletResponse response){
String result = "{\"result\":\"error\"}";
if(userManager.delUser(id)){
result = "{\"result\":\"success\"}";
}
response.setContentType("application/json");
PrintWriter pw;
try {
pw = response.getWriter();
pw.write(result);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@RequestMapping("/getUser")
public String getUser(String id,HttpServletRequest request){
User user = userManager.getUser(id);
request.setAttribute("user", user);
return "editUser";
}
@RequestMapping("/updateUser")
public String updateUser(User user,HttpServletRequest request){
if(userManager.updateUser(user)){
userManager.getUser(user.getId());
request.setAttribute("user", user);
return "/editUser";
}else{
return "/error";
}
}
}
-- |
-- |
package com.zyh.web.controller;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.zyh.web.controller.entity.User;
import com.zyh.web.controller.service.IUserManager;
@Controller
@RequestMapping("/user")
public class UserController {
@Resource(name="userManager")
private IUserManager userManager;
@RequestMapping("/toAddUser")
public String toAddUser(){
return "/addUser";
}
@RequestMapping("/addUser")
public String addUser(User user){
userManager.addUser(user);
return "redirect:/user/getAllUser";
}
@RequestMapping("/getAllUser")
public String getAllUser(HttpServletRequest request){
List<User> user = userManager.getAllUser();
request.setAttribute("user", user);
return "/userManager";
}
@RequestMapping("/delUser")
public void delUser(String id,HttpServletResponse response){
String result = "{\"result\":\"error\"}";
if(userManager.delUser(id)){
result = "{\"result\":\"success\"}";
}
response.setContentType("application/json");
PrintWriter pw;
try {
pw = response.getWriter();
pw.write(result);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@RequestMapping("/getUser")
public String getUser(String id,HttpServletRequest request){
User user = userManager.getUser(id);
request.setAttribute("user", user);
return "editUser";
}
@RequestMapping("/updateUser")
public String updateUser(User user,HttpServletRequest request){
if(userManager.updateUser(user)){
userManager.getUser(user.getId());
request.setAttribute("user", user);
return "/editUser";
}else{
return "/error";
}
}
}
package com.zyh.web.controller.service;
import java.util.List;
import com.zyh.web.controller.dao.IUserDAO;
import com.zyh.web.controller.entity.User;
public class UserManager implements IUserManager {
private IUserDAO userDao;
public void setUserDao(IUserDAO userDao) {
this.userDao = userDao;
}
@Override
public void addUser(User user) {
// TODO Auto-generated method stub
userDao.addUser(user);
}
@Override
public List<User> getAllUser() {
// TODO Auto-generated method stub
return userDao.getAllUser();
}
@Override
public boolean delUser(String id) {
// TODO Auto-generated method stub
return userDao.delUser(id);
}
@Override
public User getUser(String id) {
// TODO Auto-generated method stub
return userDao.getUser(id);
}
@Override
public boolean updateUser(User user) {
// TODO Auto-generated method stub
return userDao.updateUser(user);
}
}
-- |
package com.zyh.web.controller.service;
import java.util.List;
import com.zyh.web.controller.entity.User;
public interface IUserManager {
public void addUser(User user);
public List<User> getAllUser();
public boolean delUser(String id);
public User getUser(String id);
public boolean updateUser(User user);
}
-- |
-- |
package com.zyh.web.controller.dao;
import java.util.List;
import org.hibernate.Query;
import org.hibernate.SessionFactory;
import com.zyh.web.controller.entity.User;
public class UserDAO implements IUserDAO {
private SessionFactory sessionFactory;
public void setSessionFactory(SessionFactory sessionFactory) {
this.sessionFactory = sessionFactory;
}
@Override
public void addUser(User user) {
// TODO Auto-generated method stub
sessionFactory.getCurrentSession().save(user);
}
@Override
public List<User> getAllUser() {
// TODO Auto-generated method stub
String hql = "from User";
Query query = sessionFactory.getCurrentSession().createQuery(hql);
return query.list();
}
@Override
public User getUser(String id) {
// TODO Auto-generated method stub
String hql = "from User u where u.id=?";
Query query = sessionFactory.getCurrentSession().createQuery(hql);
query.setString(0, id);
return (User) query.uniqueResult();
}
@Override
public boolean delUser(String id) {
// TODO Auto-generated method stub
String hql = "delete User u where u.id=?";
Query query = sessionFactory.getCurrentSession().createQuery(hql);
query.setString(0, id);
return (query.executeUpdate()>0);
}
@Override
public boolean updateUser(User user) {
// TODO Auto-generated method stub
String hql = "update User u set u.userName=?,u.age=? where u.id=?";
Query query = sessionFactory.getCurrentSession().createQuery(hql);
query.setString(0, user.getUserName());
query.setString(1, user.getAge());
query.setString(2, user.getId());
return (query.executeUpdate()>0);
}
}
package com.zyh.web.controller.dao;
import java.util.List;
import com.zyh.web.controller.entity.User;
public interface IUserDAO {
public void addUser(User user);
public List<User> getAllUser();
public User getUser(String id);
public boolean delUser(String id);
public boolean updateUser(User user);
}
-- |
package com.zyh.web.controller.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
@Entity
@Table(name="T_USER")
public class User {
@GeneratedValue(generator = "system-uuid")
@GenericGenerator(name = "system-uuid", strategy = "uuid")
@Column(length=32)
@Id
private String id;
@Column(length=32)
private String userName;
@Column(length=32)
private String age;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getAge() {
return age;
}
public void setAge(String age) {
this.age = age;
}
}
-- |
* @param bytes
* @param opts
* @return Bitmap
*/
public static Bitmap getPicFromBytes(byte[] bytes, BitmapFactory.Options opts) {
if (bytes != null)
if (opts != null)
return BitmapFactory.decodeByteArray(bytes, 0, bytes.length, opts);
else
return BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
return null;
}
榪欓噷鎴戜滑涓昏鏉ヤ粙緇嶄竴涓狟itmapFactory.Options榪欎釜綾?br />
BitmapFactory.Options榪欎釜綾葷殑璇﹁В濡備笅錛?/span>
public Bitmap | inBitmap | If set, decode methods that take the Options object will attempt to reuse this bitmap when loading content. |
public int | inDensity | The pixel density to use for the bitmap. |
public boolean | inDither | If dither is true, the decoder will attempt to dither the decoded image. |
public boolean | inInputShareable | This field works in conjuction with inPurgeable. |
public boolean | inJustDecodeBounds | If set to true, the decoder will return null (no bitmap), but the out… |
public boolean | inMutable | If set, decode methods will always return a mutable Bitmap instead of an immutable one. |
public boolean | inPreferQualityOverSpeed | If inPreferQualityOverSpeed is set to true, the decoder will try to decode the reconstructed image to a higher quality even at the expense of the decoding speed. |
publicBitmap.Config | inPreferredConfig | If this is non-null, the decoder will try to decode into this internal configuration. |
public boolean | inPurgeable | If this is set to true, then the resulting bitmap will allocate its pixels such that they can be purged if the system needs to reclaim memory. |
public int | inSampleSize | If set to a value > 1, requests the decoder to subsample the original image, returning a smaller image to save memory. |
public boolean | inScaled | When this flag is set, if inDensity and inTargetDensity are not 0, the bitmap will be scaled to match inTargetDensity when loaded, rather than relying on the graphics system scaling it each time it is drawn to a Canvas. |
public int | inScreenDensity | The pixel density of the actual screen that is being used. |
public int | inTargetDensity | The pixel density of the destination this bitmap will be drawn to. |
public byte[] | inTempStorage | Temp storage to use for decoding. |
public boolean | mCancel | Flag to indicate that cancel has been called on this object. |
public int | outHeight | The resulting height of the bitmap, set independent of the state of inJustDecodeBounds. |
public String | outMimeType | If known, this string is set to the mimetype of the decoded image. |
public int | outWidth | The resulting width of the bitmap, set independent of the state of inJustDecodeBounds. |
榪欎釜琛ㄦ牸鏄粠android sdk鏂囨。閲屾憳鍑烘潵鐨勶紝綆鍗曠湅涓涓嬭鏄庡氨鏄庣櫧鏄粈涔堟剰鎬濅簡(jiǎn)銆?br />涓嬮潰鎴戜滑鍥炲埌鎴戜滑鐨勪富棰樹(shù)笂鏉ワ細(xì)鎬庢牱鑾峰彇鍥劇墖鐨勫ぇ灝忥紵
鎬濊礬寰堢畝鍗曪細(xì)
棣栧厛鎴戜滑鎶婅繖涓浘鐗囪漿鎴怋itmap錛岀劧鍚庡啀鍒╃敤Bitmap鐨刧etWidth()鍜実etHeight()鏂規(guī)硶灝卞彲浠ュ彇鍒板浘鐗囩殑瀹介珮?shù)簡(jiǎn)銆?br />鏂伴棶棰樺張鏉ヤ簡(jiǎn)錛屽湪閫氳繃BitmapFactory.decodeFile(String path)鏂規(guī)硶灝嗙獊鐮磋漿鎴怋itmap鏃訛紝閬囧埌澶т竴浜涚殑鍥劇墖錛屾垜浠粡甯鎬細(xì)閬囧埌OOM(Out Of Memory)鐨勯棶棰樸傛庝箞閬垮厤瀹冨憿錛?br />榪欏氨鐢ㄥ埌浜?jiǎn)鎴戜滑涓婇潰鎻愬埌鐨凚itmapFactory.Options榪欎釜綾匯?/p>
BitmapFactory.Options榪欎釜綾伙紝鏈変竴涓瓧孌靛彨鍋?inJustDecodeBounds 銆係DK涓榪欎釜鎴愬憳鐨勮鏄庢槸榪欐牱鐨勶細(xì)
If set to true, the decoder will return null (no bitmap), but the out…
涔熷氨鏄錛屽鏋滄垜浠妸瀹冭涓簍rue錛岄偅涔圔itmapFactory.decodeFile(String path, Options opt)騫朵笉浼?xì)鐪熺殑杩斿洖涓涓狟itmap緇欎綘錛屽畠浠呬粎浼?xì)鎶婂畠鐨勫锛岄珮鍙栧洖鏉ゾl欎綘錛岃繖鏍峰氨涓嶄細(xì)鍗犵敤澶鐨勫唴瀛橈紝涔熷氨涓嶄細(xì)閭d箞棰戠箒鐨勫彂鐢烵OM浜?jiǎn)銆?br />紺轟緥浠g爜濡備笅錛?/p>
澶嶅埗浠g爜
榪欐浠g爜涔嬪悗錛宱ptions.outWidth 鍜?options.outHeight灝辨槸鎴戜滑鎯寵鐨勫鍜岄珮?shù)簡(jiǎn)銆?/p>
鏈変簡(jiǎn)瀹斤紝楂樼殑淇℃伅錛屾垜浠庢牱鍦ㄥ浘鐗囦笉鍙樺艦鐨勬儏鍐典笅鑾峰彇鍒板浘鐗囨寚瀹氬ぇ灝忕殑緙╃暐鍥懼憿錛?br />姣斿鎴戜滑闇瑕佸湪鍥劇墖涓嶅彉褰㈢殑鍓嶆彁涓嬪緱鍒板搴︿負(fù)200鐨勭緝鐣ュ浘銆?br />閭d箞鎴戜滑闇瑕佸厛璁$畻涓涓嬬緝鏀句箣鍚庯紝鍥劇墖鐨勯珮搴︽槸澶氬皯
澶嶅埗浠g爜
榪欐牱铏界劧鎴戜滑鍙互寰楀埌鎴戜滑鏈熸湜澶у皬鐨処mageView
浣嗘槸鍦ㄦ墽琛孊itmapFactory.decodeFile(path, options);鏃訛紝騫舵病鏈夎妭綰﹀唴瀛樸?/span>瑕佹兂鑺傜害鍐呭瓨錛岃繕闇瑕佺敤鍒癇itmapFactory.Options榪欎釜綾婚噷鐨?inSampleSize 榪欎釜鎴愬憳鍙橀噺銆?/span>
鎴戜滑鍙互鏍規(guī)嵁鍥劇墖瀹為檯鐨勫楂樺拰鎴戜滑鏈熸湜鐨勫楂樻潵璁$畻寰楀埌榪欎釜鍊箋?/span>
鍙﹀錛屼負(fù)浜?jiǎn)鑺偩U﹀唴瀛樻垜浠繕鍙互浣跨敤涓嬮潰鐨勫嚑涓瓧孌碉細(xì)
public void doSome();
public void exectueMethod();
}
絎簩閮ㄥ垎錛氬湪涓涓被閲岄潰鎶婂畠褰撳仛鍙傛暟騫剁敤鍒拌鍙傛暟
濡備笅鎵紺猴細(xì)
public class MethodB {
public double getTime(CallBackInterface callBack){
long start = System.currentTimeMillis();
callBack.exectueMethod();
long end = System.currentTimeMillis();
System.out.println("cost time="+(end-start));
return end-start;
}
}
絎笁閮ㄥ垎錛氬湪鍙﹀涓涓被閲岄潰璋冪敤鍒癵etTime鏂規(guī)硶騫跺疄鐜板洖璋冨嚱鏁?br />濡備笅鎵紺?
public class MethodA {
public static void main(String[] args) {
MethodB b = new MethodB();
double d = b.getTime(new CallBackInterface() {
@Override
public void exectueMethod() {
// TODO Auto-generated method stub
new MethodA().testMethod();
}
@Override
public void doSome() {
// TODO Auto-generated method stub
}
});
System.out.println("d="+d);
}
public void testMethod(){
for(int i=0;i<10000;i++)
System.out.print("");
}
}
杈撳嚭緇撴灉錛?/p>
cost time=31
d=31.0
鐞嗚В“鍥炶皟鍑芥暟”
鎵璋撳洖璋冿紝灝辨槸瀹㈡埛紼嬪簭CLIENT璋冪敤鏈嶅姟紼嬪簭SERVER涓殑鏌愪釜鍑芥暟SA錛岀劧鍚嶴ERVER鍙堝湪鏌愪釜鏃跺欏弽榪囨潵璋冪敤CLIENT涓殑鏌愪釜鍑芥暟CB錛屽浜嶤LIENT鏉ヨ錛岃繖涓狢B渚垮彨鍋氬洖璋冨嚱鏁般備緥濡俉in32涓嬬殑紿楀彛榪囩▼鍑芥暟灝辨槸涓涓吀鍨嬬殑鍥炶皟鍑芥暟銆?
涓鑸鏉ワ紝CLIENT涓嶄細(xì)鑷繁璋冪敤CB錛孋LIENT鎻愪緵CB鐨勭洰鐨勫氨鏄SERVER鏉ヨ皟鐢ㄥ畠錛岃屼笖鏄疌LIENT涓嶅緱涓嶆彁渚涖傜敱浜嶴ERVER騫朵笉鐭ラ亾CLIENT鎻愪緵鐨凜B鍙敋鍚嶈皝錛屾墍浠ERVER浼?xì)绾﹀畾CB鐨勬帴鍙h鑼冿紙鍑芥暟鍘熷瀷錛夛紝鐒跺悗鐢盋LIENT鎻愬墠閫氳繃SERVER鐨勪竴涓嚱鏁癛鍛婅瘔SERVER鑷繁灝嗚浣跨敤CB鍑芥暟錛岃繖涓繃紼嬬О涓哄洖璋冨嚱鏁扮殑娉ㄥ唽錛孯縐頒負(fù)娉ㄥ唽鍑芥暟銆俉eb SERVERerviCliente浠ュ強(qiáng)Java鐨凴MI閮界敤鍒板洖璋冩満鍒訛紝鍙互璁塊棶榪滅▼鏈嶅姟鍣ㄧ▼搴忋?
涓嬮潰涓句釜閫氫織鐨勪緥瀛愶細(xì)
鏌愬ぉ錛屾垜鎵撶數(shù)璇濆悜浣犺鏁欓棶棰橈紝褰撶劧鏄釜闅鵑錛?)錛屼綘涓鏃舵兂涓嶅嚭瑙e喅鏂規(guī)硶錛屾垜鍙堜笉鑳芥嬁鐫鐢?shù)璇濆湪閭i噷鍌唤{夛紝浜庢槸鎴戜滑綰﹀畾錛氱瓑浣犳兂鍑哄姙娉曞悗鎵撴墜鏈洪氱煡鎴戯紝榪欐牱錛屾垜灝辨寕鎺夌數(shù)璇濆姙鍏跺畠浜嬫儏鍘諱簡(jiǎn)銆傝繃浜?jiǎn)XX鍒嗛挓錛屾垜鐨勬墜鏈哄搷浜?jiǎn)锛屼綘鍏撮珮閲囩儓鐨勮闂宸簿l忔悶瀹氾紝搴旇濡傛榪欒埇澶勭悊銆傛晠浜嬪埌姝ょ粨鏉熴傝繖涓緥瀛愯鏄庝簡(jiǎn)“寮傛錛嬪洖璋?#8221;鐨勭紪紼嬫ā寮忋傚叾涓紝浣犲悗鏉ユ墦鎵嬫満鍛婅瘔鎴戠粨鏋滀究鏄竴涓?#8220;鍥炶皟”榪囩▼錛涙垜鐨勬墜鏈哄彿鐮佸繀欏誨湪浠ュ墠鍛婅瘔浣狅紝榪欎究鏄敞鍐屽洖璋冨嚱鏁幫紱鎴戠殑鎵嬫満鍙風(fēng)爜搴旇鏈夋晥騫朵笖鎵嬫満鑳藉鎺ユ敹鍒頒綘鐨勫懠鍙紝榪欐槸鍥炶皟鍑芥暟蹇呴』絎﹀悎鎺ュ彛瑙勮寖銆?
閫氳繃涓婇潰涓漢鎰熻鍒板洖璋冨嚱鏁版洿澶氱殑搴旂敤灝辨槸緇撳悎寮傛銆傛瘮濡傦細(xì)ajax涓璲Server閫氳繃緇勪歡鍜屾湇鍔″櫒鐨勫紓姝ラ氫俊銆?
浠涔堟槸鍥炶皟鍑芥暟
綺懼姣斿柣:鍥炶皟鍑芥暟榪樼湡鏈夌偣鍍忔?zhèn)ㄩ殢桧n甯︾殑BP鏈猴細(xì)鍛婅瘔鍒漢鍙風(fēng)爜錛屽湪瀹冩湁浜嬫儏鏃禖all鎮(zhèn)?
鍥炶皟鐢ㄤ簬灞傞棿鍗忎綔錛屼笂灞傚皢鏈眰鍑芥暟瀹夎鍦ㄤ笅灞傦紝榪欎釜鍑芥暟灝辨槸鍥炶皟錛岃屼笅灞傚湪涓瀹氭潯浠朵笅瑙﹀彂鍥炶皟錛屼緥濡備綔涓轟竴涓┍鍔紝鏄竴涓簳灞傦紝浠栧湪鏀跺埌涓涓暟鎹椂錛岄櫎浜?jiǎn)瀹屾垚鏈眰鐨勫鐞嗗伐浣滃锛寴q樺皢榪涜鍥炶皟錛屽皢榪欎釜鏁版嵁浜ょ粰涓婂眰搴旂敤灞傛潵鍋氳繘涓姝ュ鐞嗭紝榪欏湪鍒嗗眰鐨勬暟鎹氫俊涓緢鏅亶銆?
鍏跺疄鍥炶皟鍜孉PI闈炲父鎺ヨ繎錛屼粬浠殑鍏辨ч兘鏄法灞傝皟鐢ㄧ殑鍑芥暟銆備絾鍖哄埆鏄疉PI鏄綆灞傛彁渚涚粰楂樺眰鐨勮皟鐢紝涓鑸繖涓嚱鏁板楂樺眰閮芥槸宸茬煡鐨勶紱鑰屽洖璋冩濂界浉鍙嶏紝浠栨槸楂樺眰鎻愪緵緇欏簳灞傜殑璋冪敤錛屽浜庝綆灞備粬鏄湭鐭ョ殑錛屽繀欏葷敱楂樺眰榪涜瀹夎錛岃繖涓畨瑁呭嚱鏁板叾瀹炲氨鏄竴涓綆灞傛彁渚涚殑API錛屽畨瑁呭悗浣庡眰涓嶇煡閬撹繖涓洖璋冪殑鍚嶅瓧錛屼絾瀹冮氳繃涓涓嚱鏁版寚閽堟潵淇濆瓨榪欎釜鍥炶皟錛屽湪闇瑕佽皟鐢ㄦ椂錛屽彧闇寮曠敤榪欎釜鍑芥暟鎸囬拡鍜岀浉鍏崇殑鍙傛暟鎸囬拡銆?/span>
鍏跺疄錛氬洖璋冨氨鏄鍑芥暟鍐欏湪楂樺眰錛屼綆灞傞氳繃涓涓嚱鏁版寚閽堜繚瀛樿繖涓嚱鏁幫紝鍦ㄦ煇涓簨浠剁殑瑙﹀彂涓嬶紝浣庡眰閫氳繃璇ュ嚱鏁版寚閽堣皟鐢ㄩ珮灞傞偅涓嚱鏁般?/span>
銆愬弬鑰冦?/span>
http://blog.csdn.net/sweetwxh/article/details/2067139
http://liutiemeng.blog.51cto.com/120361/18874
http://kidult.iteye.com/blog/148982
-- |
public static void main(String[] args) {
MethodB b = new MethodB();
double d = b.getTime(new CallBackInterface() {
@Override
public void exectueMethod() {
// TODO Auto-generated method stub
new MethodA().testMethod();
}
@Override
public void doSome() {
// TODO Auto-generated method stub
}
});
System.out.println("d="+d);
}
public void testMethod(){
for(int i=0;i<10000;i++)
System.out.print("");
}
<%@ page language="java" contentType="text/html; charset=gbk"
pageEncoding="gbk"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gbk">
</head>
<body>
sitemesh鐨勪緥<hr>
</body>
</html>
鏈〉鍙湁灝辨槸鏈彞.
棣栧厛鍦╡clipse 鐨勮彍鍗曟爮 閫夋嫨window鑿滃崟涓嬬殑preferences
閫夋嫨General 涓嬮潰鐨凬etworkConnections 灝咥ctiveProvider 鏀逛負(fù)Direct鍗沖彲
2.eclipse瀵煎叆宸ョ▼
file->import->Existing Projects into Workspace