My question is very tricky. Actually, my spring-boot
project is ok
one way: ./gradlew bootRun
is can start
another way: Run Application
is not ok
I guess spring-boot
set default config not effective, but I don't know solve it.
yml config and code
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).`