简体   繁体   中英

Spring data facet does not work in Intellij 14

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 ie 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 Intelij设置

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

这是一个错误, https: //youtrack.jetbrains.com/issue/IDEA-137023应该用Intelij 15修复。

It was a silly problem in my case - I missed enabling appropriate plugins ( File -> Settings -> Plugins ):

  • Database Tools and SQL
  • Hibernate Support
  • Java EE: EJB, JPA, Servlets
  • Spring Data

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM