I have clearly what seems to be some configuration issue, but I've been unable to resolve this myself. I have hope you guys could help me?
None of the examples I find indicate having to create a bean for EntityManagerFactoryBuilder so what's the issue.
I am attempting to configure completely separate datasources, including different entity managers etc..
My Error:
APPLICATION FAILED TO START
Description:
Parameter 0 of method entityManagerFactory required a bean of type 'org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder' that could not be found.
Action:
Consider defining a bean of type 'org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder' in your configuration.
My DataSourceConfiguration
package ...;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import javax.sql.DataSource;
@Configuration
@EnableTransactionManagement
public class DataSourceConfiguration {
@Primary
@Bean()
@ConfigurationProperties(prefix="spring.my.datasource")
public DataSource myDataSource() {
return DataSourceBuilder.create().build();
}
@Primary
@Bean(name = "myEntityManager")
public LocalContainerEntityManagerFactoryBean entityManagerFactory(EntityManagerFactoryBuilder factoryBuilder,
@Qualifier("myEntityManager") DataSource bds) {
...
}
}
My Application
@SpringBootApplication(exclude = {
DataSourceAutoConfiguration.class,
HibernateJpaAutoConfiguration.class,
JpaRepositoriesAutoConfiguration.class,
DataSourceTransactionManagerAutoConfiguration.class
})
My Pom
2.0.0.RELEASE
– Coastward