码云账号不再使用社区账号进行二次身份验证的通知 详情
私信发送成功
检测到您已登录技术前沿网,是否 一键登录码云
Watch Star Fork

技术前沿网 / spring-demoJava

利用模版方法和泛型重构dao层
messfairy 提交于   master
commit b1882e3fb79cac8ad5e8ce9c43441b8b889585bc
1 parent 04624cc955

2 文件发生了变化, 影响行数: +6 -7

  • src/main/java/messfairy/DatabaseConfig.java +6 -6
  • src/main/java/messfairy/dao/AbstractDao.java +0 -1
@@ -20,12 +20,12 @@ public class DatabaseConfig {
// instantiate, configure and return DataSource
BasicDataSource dataSource = new BasicDataSource();
dataSource.setDriverClassName("com.mysql.jdbc.Driver");
- dataSource.setUrl("jdbc:mysql://localhost/myblog?characterEncoding=utf-8");
- dataSource.setUsername("root");
- dataSource.setPassword("root");
-// dataSource.setUrl("jdbc:mysql://10.4.12.173:3306/dd984836e9dde4d35b01ab87ec11b14f1?characterEncoding=utf-8");
-// dataSource.setUsername("umKFSjZ742Zih");
-// dataSource.setPassword("pTF2665xEkjWY");
+// dataSource.setUrl("jdbc:mysql://localhost/myblog?characterEncoding=utf-8");
+// dataSource.setUsername("root");
+// dataSource.setPassword("root");
+ dataSource.setUrl("jdbc:mysql://10.4.12.173:3306/dd984836e9dde4d35b01ab87ec11b14f1?characterEncoding=utf-8");
+ dataSource.setUsername("umKFSjZ742Zih");
+ dataSource.setPassword("pTF2665xEkjWY");
dataSource.setValidationQuery("SELECT 1");
configureDataSource(dataSource);
return dataSource;
package messfairy.dao;
 
-import messfairy.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;

登录 后才可以发表评论

Float_left Icon_close