I want to fill some tables of my DB from a text file on startup, I want my initialization method to be called only when my application do start.
I am using Spring (+MVC) and Hibernate with MySQL.
how can I do?
Use the postconstuct annotation somewhere inside a bean :
@PostConstruct
public void init() {
//startup logic here
}
Probably makes (desgin) sense to use a configuration bean, but it can be any bean at all.