title: How to configure this code as spring Bean?
body: <p>I have this code:</p>
  
  <pre><code>SessionFactory sessionFactory = new Configuration().configure("hibernate.cfg.xml");
  </code></pre>
  
  <p>How i may to configure this as bean?
  hibernate.cfg.xml contain this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE hibernate-configuration PUBLIC
          "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
          "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"&gt;
  &lt;hibernate-configuration&gt;
      &lt;session-factory name="sessionFactory"&gt;
          &lt;property name="hibernate.connection.driver_class"&gt;oracle.jdbc.driver.OracleDriver&lt;/property&gt;
          &lt;property name="hibernate.connection.password"&gt;scott&lt;/property&gt;
          &lt;property name="hibernate.connection.url"&gt;jdbc:oracle:thin:@x.x:1521:x&lt;/property&gt;
          &lt;property name="hibernate.connection.username"&gt;scott&lt;/property&gt;
          &lt;property name="hibernate.default_schema"&gt;SCOTT&lt;/property&gt;
          &lt;property name="hibernate.dialect"&gt;org.hibernate.dialect.Oracle10gDialect&lt;/property&gt;
          &lt;property name="hibernate.search.autoregister_listeners"&gt;false&lt;/property&gt;
          &lt;mapping resource="ormbyxml/domain/Emp.hbm.xml" /&gt;
          &lt;mapping resource="ormbyxml/domain/SalaryLog.hbm.xml" /&gt;
          &lt;mapping resource="ormbyxml/domain/Dept.hbm.xml" /&gt;
          &lt;mapping resource="ormbyxml/domain/Salgrade.hbm.xml" /&gt;
          &lt;mapping resource="ormbyxml/domain/Bonus.hbm.xml" /&gt;
      &lt;/session-factory&gt;
  &lt;/hibernate-configuration&gt;
  </code></pre>