I want to use SpringBoot with Ebean. I found this article: http://ebean-orm.github.io/docs/setup/spring and I could set it up and make it work with an own implementation of a EbeanServerFactory as shown in the article.
It states, that if I add ebean-spring to my dependencies along with a default-ebean-server.xml than it should work with a default EbeanServerFactoryBean. But what should I write to this file? Where do I set up the FactoryBean to use my datasource etc.? Sorry if my question is silly, but I am really new to SpringBoot and don't understand it deeply.
If I add ebean-spring and remove my own factory I get an error:
No qualifying bean of type [com.avaje.ebean.EbeanServer] found for dependency
So I could solve it after a day of thinking, and trying. In Spring you usually have an Application.java or something which starts your app with your main(). Here you can define a EbeanServer Factory like the following:
@Bean
public EbeanServerFactoryBean ebeanServerFactoryBean() {
EbeanServerFactoryBean ebeanServerFactoryBean = new EbeanServerFactoryBean();
ServerConfig config = new ServerConfig();
config.setName("pg");
config.loadFromProperties();
//other configs
config.setDefaultServer(true);
ebeanServerFactoryBean.setServerConfig(config);
return ebeanServerFactoryBean;
}