随笔分类 -  Spring

Spring框架
摘要:Spring中的JDBC为我们省去连接和关闭数据库的代码,我们着重关注对数据库的操作。Spring框架在数据库开发中的应用主要使用的是JDBCTemplate类,该类作为Spring对JDBC支持的核心,提供了所有对数据库操作功能的支持。我们将使用JDBCTemplate类完成对mysql数据库的增 阅读全文
posted @ 2020-05-02 09:26 与f 阅读(1608) 评论(0) 推荐(0)
摘要:In this tutorial, we will extend last Maven + Spring hello world example by adding JDBC support, to use Spring + JDBC to insert a record into a custom 阅读全文
posted @ 2020-05-02 08:55 与f 阅读(318) 评论(0) 推荐(0)
摘要:Spring + JdbcTemplate + JdbcDaoSupport examples In Spring JDBC development, you can use JdbcTemplate and JdbcDaoSupport classes to simplify the overal 阅读全文
posted @ 2020-05-02 08:40 与f 阅读(299) 评论(0) 推荐(0)
摘要:<context:property-placeholder location="属性文件,多个之间逗号分隔" file-encoding="文件编码" ignore-resource-not-found="是否忽略找不到的属性文件" ignore-unresolvable="是否忽略解析不到的属性, 阅读全文
posted @ 2020-04-30 17:21 与f 阅读(2086) 评论(0) 推荐(0)
摘要:一:通过context:property-placeholder标签实现配置文件加载 在spring的配置文件中添加如下声明 <context:property-placeholder ignore-unresolvable="true" location="classpath:jdbc.prope 阅读全文
posted @ 2020-04-30 17:20 与f 阅读(3992) 评论(0) 推荐(0)
摘要:ssm项目tomcat启动后报以下问题 log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).log4j:WARN Please initialize the 阅读全文
posted @ 2020-04-30 17:04 与f 阅读(4233) 评论(0) 推荐(0)
摘要:众所周知,基本上javaee的配置文件都放在WEB-INF之下,javaee网页工程默认读取配置文件也只会在这个目录下面读,但经常看到一些javaee不知道是装逼,还是因为用myeclipse自动生成,还是为了好管理的原因,将工程的配置文件移到其它文件夹,他们基本利用了SpringMVC的conte 阅读全文
posted @ 2020-04-29 16:53 与f 阅读(785) 评论(0) 推荐(0)
摘要:在使用Spring框架的时候,如果我们使用的是XML文件配置Bean的方式的话,我们往往会在web.xml里面配置如下内容: <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/co 阅读全文
posted @ 2020-04-29 16:28 与f 阅读(616) 评论(0) 推荐(0)
摘要:在web.xml中通过contextConfigLocation配置spring,contextConfigLocation参数定义了要装入的 Spring 配置文件。 1. 在web.xml里配置需要加载的spring配置文件。 如果要装入多个配置文件,在<param-value>标记中用逗号作分 阅读全文
posted @ 2020-04-29 15:59 与f 阅读(1872) 评论(0) 推荐(0)
摘要:SLF4J代表Simple Logging Facade for Java。它提供了Java中所有日志框架的简单抽象。因此,它使用户能够使用单个依赖项处理任何日志框架,例如:Log4j,Logback和JUL(java.util.logging)。可以在运行时/部署时迁移到所需的日志记录框架。 每个 阅读全文
posted @ 2020-04-29 00:56 与f 阅读(406) 评论(0) 推荐(0)
摘要:日志是应用软件中不可缺少的部分,Apache的开源项目log4j是一个功能强大的日志组件,提供方便的日志记录。在apache网站:jakarta.apache.org/log4j 可以免费下载到Log4j最新版本的软件包。 一、入门实例 1.新建一个JAva工程,导入包log4j-1.2.17.ja 阅读全文
posted @ 2020-04-29 00:37 与f 阅读(3420) 评论(0) 推荐(0)
摘要:一、 通过@PathVariabl获取路径中的参数 例如,访问user/123/lei路径时,执行以上方法,其中,参数id=123,name=lei 二、 @ModelAttribute获取POST请求的FORM表单数据 JSP表单如下 Java Pojo如下(可以写get set 方法,不要写有参 阅读全文
posted @ 2017-08-17 18:53 与f 阅读(254) 评论(0) 推荐(0)
摘要:1.配置文件 2.数据类 3.dao接口 4.实现这个dao接口 5.测试类 6.结果 本次参考文章:http://blog.csdn.net/mypanlong/article/details/46984535 下次实验:有C3P0的配置,链接数据库 下次参考:http://www.cnblogs 阅读全文
posted @ 2017-08-10 00:50 与f 阅读(373) 评论(0) 推荐(0)
摘要:特殊字符用<![CDATA[]]>包含 阅读全文
posted @ 2017-08-09 15:55 与f 阅读(2305) 评论(0) 推荐(0)
摘要:1.可以自动加载注解驱动,通过注解找到对应Controller <!-- spring MVC 注解驱动 --> <mvc:annotation-driven></mvc:annotation-driven> <!-- 配置自动扫描包 --> <context:component-scan base 阅读全文
posted @ 2017-08-02 15:33 与f 阅读(288) 评论(0) 推荐(0)
摘要:在src目录下建立applicationContext.xml (Spring 管理 bean的配置文件) 2.java的数据类型 3.测试类 结果: 阅读全文
posted @ 2017-08-01 14:41 与f 阅读(3945) 评论(0) 推荐(0)
摘要:Spring依赖注入的Setter注入(通过get和set方法注入) 导入必要的jar包(Spring.jar和commonslogging.jar) 在src目录下建立applicationContext.xml (Spring 管理 bean的配置文件) 2.Setter注入 java的数据类型 阅读全文
posted @ 2017-07-23 17:07 与f 阅读(6068) 评论(0) 推荐(0)
摘要:Spring 通过2种方式管理bean 首先要导入Spring的包,(Spring.jar和commonslogging.jar) 或加载分开的... 在src目录下建立applicationContext.xml (Spring 管理 bean的配置文件) 1.使用BeanFactory管理bea 阅读全文
posted @ 2017-07-23 16:13 与f 阅读(437) 评论(0) 推荐(0)