Right now I am in progress of setup REST api template. I want to use spring boot with spring data integration, everything works nice, but I would like to take an advantages in Intellij 14 spring data plugin and enable autocompletion on i.e. findByFirstName(...)
. I try to achieve something like in this intelij 11 demo http://blog.jetbrains.com/idea/2011/11/enjoy-spring-data-jpa-in-intellij-11/
How to enable spring data plugin in existing project?
My current configuration
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
@Configuration
@EnableTransactionManagement
@EnableJpaRepositories("com.test.repository")
public class TestDataBaseConfiguration {
@Bean
public DataSource dataSource() {
return new EmbeddedDatabaseBuilder().setType(EmbeddedDatabaseType.H2).build();
}
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
entityManagerFactoryBean.setDataSource(dataSource());
entityManagerFactoryBean.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
entityManagerFactoryBean.setPackagesToScan("com.test.entities");
entityManagerFactoryBean.setJpaProperties(jpaProperties());
return entityManagerFactoryBean;
}
private Properties jpaProperties() {
Properties properties = new Properties();
properties.setProperty("hibernate.hbm2ddl.auto", "create-drop");
properties.setProperty("hibernate.dialect", "org.hibernate.dialect.H2Dialect");
properties.setProperty("hibernate.show_sql", "false");
properties.setProperty("hibernate.format_sql", "false");
return properties;
}
@Bean
public JpaTransactionManager transactionManager() {
JpaTransactionManager transactionManager = new JpaTransactionManager();
transactionManager.setEntityManagerFactory(entityManagerFactory().getObject());
transactionManager.setDataSource(dataSource());
return transactionManager;
}
}
It is a bug, https://youtrack.jetbrains.com/issue/IDEA-137023 should be fixed with Intelij 15
It was a silly problem in my case - I missed enabling appropriate plugins (File
-> Settings
-> Plugins
):
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With