标签:hibernate classpath des 属性 .com pre pack over ber
基本知识点如下:
除了IOC基本的六个包,再引入AOP开发的包
<!-- ========================引入spring关于注解开发的context约束======================== --> <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> </beans>
package spring.day2.demo1; public interface UserDao { public void save(); }
package spring.day2.demo1; public class UserDaoImp1 implements UserDao { @Override public void save() { System.out.println("userdao的save方法已经执行......."); } }
package spring.day2.demo1; import org.junit.Test; /* * IOC注解开发入门 */ public class SpringDemo1 { @Test /* * 传统方式 */ public void demo1() { UserDao userDao = new UserDaoImp1(); userDao.save(); } }
@Test /* * IOC的注解方式 */ public void demo2() { ApplicationContext applicationContext = new ClassPathXmlApplicationContext("applicationContext3.xml"); UserDao bean = (UserDao) applicationContext.getBean("userDao"); bean.save(); }
标签:hibernate classpath des 属性 .com pre pack over ber
原文地址:https://www.cnblogs.com/zengcongcong/p/10356789.html