I'm trying to deploy My application on weblogic server, My application has an in-memory DB and since I use HSQLDB for JUNIT, I want to keep HSQL as my in-memory DB(primarily a slight better performance over derby). Since weblogic has already derby, when I try to deploy the application, The derby is getting started rather than HSQL. On Preliminary investigation I find that Since Derby is define above HSQL in EmbeddedDatabaseConnection.java, Derby database is being started first. Is there any specific configuration, where I can explicitly embedded database type to HSQL rather than allowing spring boot to start database based on library/classes
First try I can think of is to remove Derby from class path and leave there only HSQL. Spring Boot docs :
If HSQLDB is on your classpath, and you have not manually configured any database connection beans, then we will auto-configure an in-memory database.
If that's not an option, you can specify
An embedded database is detected by looking at the Connection type: hsqldb, h2 and derby are embedded, the rest are not.
HSQL explicitly as primary data source:
@Configuration public class DataSourceConfig { @Bean public DataSource dataSource() { return new EmbeddedDatabaseBuilder() .setType(EmbeddedDatabaseType.HSQL) .build(); } }
define spring.datasource.type
property
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.