📄 calendarregistry.java
字号:
package com.manning.hq.ch07;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.hibernate.SessionFactory;
/**
* A central Registry that allows developers to get references to
* the core business and data access objects in the project.
*
* Uses Spring ApplicationContext under the covers.
*/
public class CalendarRegistry {
private static ApplicationContext ctx;
static {
ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
}
/**
* Private to make this a singleton.
*/
private CalendarRegistry(){
}
public static SessionFactory getSessionFactory(){
return (SessionFactory) ctx.getBean("factory", SessionFactory.class);
}
public static EventSpringDao getEventDao(){
return (EventSpringDao)ctx.getBean("eventDao", EventSpringDao.class);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -