I have a code which starts my h2 database web server. It should be executed before datacontext
will be read by Spring.
I have read the following article: Article
can't find appropriate event.
Is there another way to achieve what I want?
I have a code which starts my h2 database web server. It should be executed before datacontext
will be read by Spring.
I have read the following article: Article
can't find appropriate event.
Is there another way to achieve what I want?
If you use hibernate, and your code are just some SQL statements, then you could use Hibernate hibernate.hbm2ddl.import_files"
<bean id="sessionFactory"
class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="hibernateProperties">
<props>
...
<prop key="hibernate.hbm2ddl.import_files">initial_data.sql</prop>
</props>
</property>
</bean>