好。这是我要使其正常工作所要做的。只是@PostConstruct方法,我们必须使用它来初始化sessionFactory,因为在构造器级别上没有注入的对象。
@Service@EnableTransactionManagementpublic class StoreAssociateService { @Autowired HibernateUtil hb; SessionFactory sessionFactory ; @PostConstruct public void init() { sessionFactory = hb.getFactory(); }}


