摘要:
在java项目中: applicationContext1.xml -> ApplicationContext conext=new ClassPathXmlApplicationContext("applicationContext.xml1") applicationContext2.xml-> 阅读全文
随笔档案-2020年04月
Spring框架配置java_web的实例化
2020-04-24 14:55 by a_mf, 220 阅读, 收藏,
摘要:
java_web的IOC的初始化,是在初始化Tomcat时自动配置 配置spring-web。jar(spring.web包)提供的监听器,此监听器乐意在服务器启动是初始化IOC容器 初始化Ioc容易(applicationcontext.xml),1、必须告诉监听器此容易的位置:context_p 阅读全文
Spring框架通过注解实现的通知的方法
2020-04-23 20:28 by a_mf, 183 阅读, 收藏,
摘要:
在通知类中: package org_shitang_aop; import org.aspectj.lang.annotation.AfterReturning; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang. 阅读全文
Spring框架的四种通知
2020-04-23 17:54 by a_mf, 279 阅读, 收藏,
摘要:
通过继承类或者实现接口的形式 前置通知: 实现类: package org_shitang_servier; import org_shitang.dao.IStudentDao; import org_shitang_dao.impl.StudentDaoImp1; import org_shit 阅读全文
Spring框架中使用注解实现事务
2020-04-22 17:18 by a_mf, 273 阅读, 收藏,
摘要:
数据库的连接部分 <!-- 配置事物管理器 txManager--> <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverCl 阅读全文
Spring框架<bean>第三种
2020-04-22 15:17 by a_mf, 92 阅读, 收藏,
摘要:
p命名空间: bean: <bean id="teacher" class="org_shitang_entity.teacher" p:name="ls" p:age="19"> </bean> <bean id="Course" class="org_shitang_entity.Course" 阅读全文
Spring框架中<bean>第二种
2020-04-22 15:04 by a_mf, 137 阅读, 收藏,
摘要:
使用构造器进行复制,<constructor-arg>该类中必须有一个无参构造 bean中,其中constructor-arg的顺序要和构造器中一样,或者加name进行控制,或者加index索引或者type: <bean id="Course" class="org_shitang_entity.C 阅读全文
Spring框架中<bean>第一种补充(1)
2020-04-22 14:29 by a_mf, 128 阅读, 收藏,
摘要:
通过依赖注入的方法: Course类中使用teacher类: package org_shitang_entity; public class Course { private String courseName; private int courseHour; private teacher te 阅读全文
Spring框架中<bean>第一种补充
2020-04-21 23:03 by a_mf, 112 阅读, 收藏,
摘要:
原始方法: main函数: public static void learnCourse(){ student student=new student(); student.learnJava(); student.learnHtml(); } public static void main(Str 阅读全文
Spring框架中<bean>第一种
2020-04-21 21:38 by a_mf, 159 阅读, 收藏,
摘要:
一、通过set、get函数用<property name=" " value=" "></property>来获取 原始方法: main函数中: public static void main(String[] args){ student student=new student(); studen 阅读全文