Open bedinsky opened 6 years ago
Hi @bedinsky,
We will plan to add a tutorial on this soon. Meanwhile, we appreciate if any community member wants to contribute to this.
As of now, you can keep applicationContext.xml
file and use
@ImportResource("classpath:applicationContext.xml")
in your SpringBootApplication class.
Hi, thank you for answering ! I do not use applicationContex.xml Here is my example if someone prefers programmatic configuration. persistence.xml is mandatory in classpath
@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
@SpringBootApplication
public class Application
{
public static void main(String[] args) {
new SpringApplicationBuilder(Application.class)
.sources(PersistenceJPAConfig.class)
.logStartupInfo(true)
.build()
.run(args);
}
}
@Configuration
@EnableTransactionManagement(order=10)
@ComponentScan({ "yourpackage.persistence" })
public class PersistenceJPAConfig {
public PersistenceJPAConfig() {
super();
}
@PostConstruct
public void init() {
}
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactoryBean() {
final LocalContainerEntityManagerFactoryBean factoryBean = new LocalContainerEntityManagerFactoryBean();
factoryBean.setPersistenceUnitName("cassandra_pu");
return factoryBean;
}
@Bean
public PlatformTransactionManager transactionManager(
final EntityManagerFactory emf) {
final JpaTransactionManager transactionManager = new JpaTransactionManager();
transactionManager.setEntityManagerFactory(emf);
return transactionManager;
}
}
this tutorial on kundera spring does not help with spring boot https://github.com/Impetus/Kundera/wiki/Building-Applications-with-Kundera-and-Spring
I'm trying to start a spring boot application with jpa using kundera but I do not find out what to write in "Application Properties File"
Eventually I have disable datasource auto configuration and instantiated a EntityManagerFactoryBean