Spring Boot : Error creating bean with name 'jpaMappingContext': java.lang.NullPointerException

前端 未结 4 1406
太阳男子
太阳男子 2021-02-07 09:20

My combination of is Spring Boot + Spring Data Jpa + Multiple Databases. I am getting following NullPointer exception when starting the application. Feels like SPring Data with

4条回答
  •  灰色年华
    2021-02-07 10:09

    Spring boot have AutoConfiguration classes enabled by default for the data sources allready on classpath. You should explicitly exclude AutoConfiguration class to disable.

    Example :

    @EnableAutoConfiguration(exclude = {JndiConnectionFactoryAutoConfiguration.class,DataSourceAutoConfiguration.class,
                                        HibernateJpaAutoConfiguration.class,JpaRepositoriesAutoConfiguration.class,DataSourceTransactionManagerAutoConfiguration.class})
    @ComponentScan
    public class MyBootApplication {
        public static void main(String[] args) {
            SpringApplication.run(MyBootApplication.class, args);
        }
    }
    

提交回复
热议问题