Łukasz Tomaszewski Łukasz Tomaszewski - 1 month ago 11
Java Question

Spring data facet does not work in Intelij 14

Right now I am in progress of setup REST api template. I want to use spring boot with spring data integration, everyting works nice, but I would like to take an advantages in Intelij 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/

Any suggestion how to enable spring data plugin in existing project?

My current configuration
Intelij settings

@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;
}
}

Answer

It is a bug, https://youtrack.jetbrains.com/issue/IDEA-137023 should be fixed with Intelij 15