簡體   English   中英

春季啟動項目:應用程序運行失敗,但是在IDE中可以使用gradle bootRun

[英]spring boot project: application run failed but gradle bootRun is ok in idea IDE

我的問題很棘手。 實際上,我的spring-boot項目可以用一種方式: ./gradlew bootRun是可以啟動的另一種方式: Run Application不可以

我想spring-boot設置默認配置無效,但我不知道解決它。

yml配置和代碼

spring: datasource: url: jdbc:mysql://localhost/test username: root

   @Bean
   public SqlSessionFactory sqlSessionFactory(DataSource dataSource) {
            SqlSessionFactoryBean factoryBean = new SqlSessionFactoryBean();
            factoryBean.setDataSource(dataSource);
            Resource mybatisResource = new ClassPathResource("mybatis-config.xml", Application.class.getClassLoader());
            factoryBean.setConfigLocation(mybatisResource);

            SqlSessionFactory sessionFactory = null;
            try {
                sessionFactory = factoryBean.getObject();
            } catch (Exception e) {
                log.error("init sqlSessionFactory failed.", e);
            }
            return sessionFactory;
        }




***************************
APPLICATION FAILED TO START
***************************

Description:

Cannot determine embedded database driver class for database type NONE

Action:

If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active).`


嘗試在您的Gradle文件中添加MySql JDBC Driver dependency

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM