📄 90f6669a09ae001c15e9ca035dc2c582
字号:
package com.v512.springdemo;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class SpringTest {
/**
* @param args
*/
public static void main(String[] args) {
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("/applicationContext.xml");
GuestbookDAO dao=(GuestbookDAO)ctx.getBean("guestbookDAO");
Guestbook g=dao.findById(new Long(1000050));
p(g);
Guestbook g2 = new Guestbook();
g2.setName("刘备");
g2.setTitle("test spring and hibernate");
dao.add(g2);
p(g2);
}
public static void p(Guestbook g){
System.out.println("-------------");
System.out.println(g.getTitle());
System.out.println(g.getName());
System.out.println("-------------");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -