I'm writing a Spring Boot application which connects with Snowflake Data Warehouse and execute SQL queries on it.
I have written a Configuration class for configuring Datasource for connecting to Snowflake Data Warehouse as follows:
#Configuration
#EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
public class DBConfig {
Logger logger = LoggerFactory.getLogger(DBConfig.class);
#Bean
JdbcTemplate jdbcTemplate() throws IllegalAccessException, InvocationTargetException, InstantiationException {
logger.info("-----Configuring JDBCTemplate------");
SnowflakeBasicDataSource dataSource = new SnowflakeBasicDataSource();
dataSource.setServerName("<myserver>.snowflakecomputing.com");
dataSource.setUser("<my_username>");
dataSource.setPassword("<my_password>");
dataSource.setWarehouse("DEMO_WH");
dataSource.setDatabaseName("DEMO_DB");
dataSource.setSchema("PUBLIC");
return new JdbcTemplate(dataSource);
}
}
My pom.xml looks like as follows:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.1.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.vaibhav</groupId>
<artifactId>snowflake-1</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>snowflake-1</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>net.snowflake</groupId>
<artifactId>snowflake-jdbc</artifactId>
<version>3.6.21</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web-services</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
I have to use a connection pool for this data source in my Spring boot application.
How can I use HikariCP connection pool in my application which can work perfectly fine with my Customized DataSource?
------EDIT --- Thanks for providing solution, finally my working code looks like
#Configuration
#EnableAutoConfiguration(exclude = { DataSourceAutoConfiguration.class })
public class DBConfig {
Logger logger = LoggerFactory.getLogger(DBConfig.class);
#Bean
JdbcTemplate jdbcTemplate() throws IllegalAccessException, InvocationTargetException, InstantiationException {
logger.info("-----Configuring JDBCTemplate------");
HikariConfig config = new HikariConfig();
config.setDriverClassName("net.snowflake.client.jdbc.SnowflakeDriver");
// config.setDataSourceProperties(properties);
config.setJdbcUrl("jdbc:snowflake://<myserver>.snowflakecomputing.com/?warehouse=DEMO_WH&db=DEMO_DB&schema=PUBLIC");
config.setUsername("<my_username>");
config.setPassword("<my_password>");
HikariDataSource ds = new HikariDataSource(config);
return new JdbcTemplate(ds);
}
}
See setting SnowflakeDriver with Hikari:
HikariConfig config = new HikariConfig();
config.setDriverClassName("com.snowflake.client.jdbc.SnowflakeDriver");
config.setDataSourceProperties(properties);
config.setJdbcUrl(connectStr);
HikariDataSource ds = new HikariDataSource(config);
If spring-jdbc is being included, Spring will automatically create JdbcTemplate based on the available DataSource. So If the above answers does not satisfy you, you may just try:
#Configuration
#EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
public class DBConfig {
Logger logger = LoggerFactory.getLogger(DBConfig.class);
// TAKE NOTE THAT THIS MIGHT ALREADY BE DONE BY SPRING
#Bean
protected JdbcTemplate jdbcTemplate( DataSource dataSource )
{
return new JdbcTemplate( dataSource );
}
#Bean
protected DataSource makeDataSource() throws IllegalAccessException, InvocationTargetException, InstantiationException {
logger.info("-----Configuring JDBCTemplate------");
SnowflakeBasicDataSource dataSource = new SnowflakeBasicDataSource();
dataSource.setServerName("<myserver>.snowflakecomputing.com");
dataSource.setUser("<my_username>");
dataSource.setPassword("<my_password>");
dataSource.setWarehouse("DEMO_WH");
dataSource.setDatabaseName("DEMO_DB");
dataSource.setSchema("PUBLIC");
return dataSource;
}
}
Hikari is default connection pool in Spring-boot 2+
We have nothing to do if we want to use Hikari in an application based
on Spring Boot 2.x.
You can set different properties of connection pool thru application.yml / application.properties. Below is an example of application.yml:
spring:
datasource
hikari:
maximumPoolSize: 4 # Specify maximum pool size
minimumIdle: 1 # Specify minimum pool size
driver-class-name: com.snowflake.client.jdbc.SnowflakeDriver
This is a useful link for configuring Hikari CP.
Related
I am trying to run a Spring Batch app that reads data from a SQL Server DB and writes to a csv file. Below is the DatabaseConfiguration file for the SQL Server DB:-
#Configuration
#EnableTransactionManagement
#EnableJpaRepositories(
basePackages = {"com.sample.repository"},
entityManagerFactoryRef = "sampleEntityManagerFactory",
transactionManagerRef = "transManager"
)
public class CompensationConfiguration
{
#Primary
#Bean(name="cmpnDS")
#ConfigurationProperties(prefix = "sample.datasource.compensation")
public DataSource sampleDataSource() {
return DataSourceBuilder.create().build();
}
#Primary
#Bean(name = "sampleEntityManagerFactory")
public LocalContainerEntityManagerFactoryBean sampleEntityManagerFactory(EntityManagerFactoryBuilder builder,
#Qualifier("cmpnDS") DataSource dataSource) {
return builder
.dataSource(dataSource)
.packages("com.opencodez.entity")
.build();
}
#Primary
#Bean(name = "transManager")
public PlatformTransactionManager hrprdTransactionManager(#Qualifier("sampleEntityManagerFactory")
EntityManagerFactory entityManagerFactoryBean) {
return new JpaTransactionManager(entityManagerFactoryBean);
}
}
Following is a snippet from the pom file:-
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.1.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>mybat</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>mybat</name>
<description>Demo project for Spring Boot</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<maven-jar-plugin.version>2.6</maven-jar-plugin.version>
<spring-cloud.version>Hoxton.RC2</spring-cloud.version>
</properties>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
and the following in the properties file:-
spring:
datasource:
url: jdbc:h2:mem:testdb
username: sa
password:
driver-class-name: org.h2.Driver
When I try to launch the app it is failing to start with the below error:-
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'h2Console' defined in class path resource [org/springframework/boot/autoconfigure/h2/H2ConsoleAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.web.servlet.ServletRegistrationBean]: Factory method 'h2Console' threw exception; nested exception is java.lang.IllegalArgumentException: dataSource or dataSourceClassName or jdbcUrl is required.
This app reads a SQL Server DB for processing records. The spring batch uses in memory DB H2Database. Is this a multi-datasource scenario? I didn't do any coding for the datasource configuration of H2 as it should be autoconfigured. I have all the required dependencies included in the pom - sprign-batch-core, devtools, h2 database, jpa etc.
I got around this by setting
spring.h2.console.enabled=false
in my spring boot application.properties file.
The doc for that property says that you could get rid of this by instead removing the pom dependency for spring-boot-devtools (detailed here).
You have to delete h2's related jar files in .m2 maven local repository, It's must be corrupted.
After that, you have to run "mvn spring-boot:run" again, Maybe more that one jar was corrupted so check it and reapet recipe (every time you need to run that command after delete that jar).
I created two Datasource Configuration classes, one for each database, and marked the h2 datasource as primary. The app started fine after this change.
I upgrade my Spring boot version from 2.0.5.RELEASE to 2.1.8.RELEASE (so Spring Integration from 5.0 to 5.1) and the automatic type casting inside integration flow doesn't work anymore. I am used to define a set of #IntegrationConverter components and automatic casting with the operation transform(Type.class, p -> p) inside integration flow code but with the new version it seems to be broken.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.8.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>org.grorg</groupId>
<artifactId>grointegration</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>grointegration</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-integration</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-ip</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
And the Main.java file:
package org.grorg.grointegration;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.core.convert.converter.Converter;
import org.springframework.integration.config.IntegrationConverter;
import org.springframework.integration.dsl.IntegrationFlow;
import org.springframework.integration.dsl.IntegrationFlows;
import org.springframework.integration.dsl.Transformers;
import org.springframework.integration.ip.dsl.Tcp;
import org.springframework.stereotype.Component;
class Test {
#Override
public String toString() {
return "test";
}
}
#Component
#IntegrationConverter
class Convert implements Converter<String, Test> {
#Override
public Test convert(String s) {
return new Test();
}
}
#SpringBootApplication
public class Main {
public static void main(String[] args) {
SpringApplication.run(GrointegrationApplication.class, args);
}
#Bean
public IntegrationFlow server() {
return IntegrationFlows
.from(Tcp.inboundGateway(Tcp.netServer(1234)))
.transform(Transformers.objectToString())
.transform(Test.class, id -> id) // in 2.1 I could use .convert(Test.class) but the problem is the same
.log()
.handle((p, h) -> "OK")
.get();
}
}
Use with a shell:
telnet localhost 1234
> test
> OK
[...]
With the previous version (2.0.5.RELEASE) the program work nicely like previously, but with the new version (2.1.8.RELEASE) I get this error (and no "OK" response):
org.springframework.integration.handler.ReplyRequiredException: No reply produced by handler 'server.org.springframework.integration.config.ConsumerEndpointFactoryBean#1', and its 'requiresReply' property is set to true.
[...]
What I have found is that the ConversionService has been remplaced by MessageConverter and now Jackson is used to transform message from one type to another.
Am I wrongly using type casting with integration flow? Do you have a new solution for casting object with the new version? Or is this just a regression?
Thanks in advance!
This is a bug in Spring Integration.
We just don't use a proper ConversionService in the GenericMessageConverter.
Please, raise a GH issue on the matter.
Meanwhile a workaround for you is like this:
#Bean(name = IntegrationContextUtils.ARGUMENT_RESOLVER_MESSAGE_CONVERTER_BEAN_NAME)
public static ConfigurableCompositeMessageConverter configurableCompositeMessageConverter(
#Qualifier(IntegrationUtils.INTEGRATION_CONVERSION_SERVICE_BEAN_NAME) ConversionService conversionService) {
return new ConfigurableCompositeMessageConverter(
Collections.singleton(new GenericMessageConverter(conversionService)));
}
So, we override whatever is configured by the framework and inject a proper IntegrationUtils.INTEGRATION_CONVERSION_SERVICE_BEAN_NAME bean which is supplied with your #IntegrationConverter component.
I am learning Spring Boot and in my first set up I got this problem:
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured
I looked up solutions on the web and did find some, including those from Stackoverflow, but none of them works.
My simple code:
#SpringBootApplication
#RestController
public class SpringBootDemoApplication {
public static void main(String[] args) {
SpringApplication.run(SpringBootDemoApplication.class, args);
}
#RequestMapping(value = "/")
public String response(){
return "You made it!";
}
}
My POM:
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
My application.properties:
spring.datasource.url=jdbc:mysql://localhost:3306/hrdb?autoReconnect=true
spring.datasource.username=root
spring.datasource.password=passw0rd
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
I also created a file as the following:
#Configuration
public class DBConfig {
#Bean
public DataSource dataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://localhost:3306/hr?autoReconnect=true");
dataSource.setUsername("root");
dataSource.setPassword("passw0rd");
return dataSource;
}
}
I got the mentioned error either in Unit Test or starting the service. The only way I find out to make it work is to disable data source auto config:
#SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
Need your help. Thanks.
Check your DB config - it seems to overwrite Spring's default data source, but the url is different than in application.properties: "jdbc:mysql://localhost:3306/hr?autoReconnect=true"
In the properties you have:
"jdbc:mysql://localhost:3306/hrdb?autoReconnect=true"
"hr" vs "hrdb".
I would get rid of this class altogether and instead declare the relevant JDBC driver in your pom.xml and let Spring take care of the connection.
I have created sample project for spring boot actuator with database testing. After running the application when I hit the URL
When Mongo DB is running
URL: http://localhost:8080/health
Response :
`{"status":"UP","diskSpace":{"status":"UP","total":493767094272,"free":404928278528,"threshold":10485760},"mongo":{"status":"UP","version":"3.0.2"}}
`
When Mongo DB is not running
URL:
http://localhost:8080/health
Response:
{"status":"DOWN","diskSpace":{"status":"UP","total":493767094272,"free":404929720320,"threshold":10485760},"mongo":{"status":"DOWN","error":"org.springframework.dao.DataAccessResourceFailureException: Timed out after 30000 ms while waiting for a server that matches ReadPreferenceServerSelector{readPreference=primary}. Client view of cluster state is {type=UNKNOWN, servers=[{address=localhost:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.ConnectException: Connection refused: connect}}]; nested exception is com.mongodb.MongoTimeoutException: Timed out after 30000 ms while waiting for a server that matches ReadPreferenceServerSelector{readPreference=primary}. Client view of cluster state is {type=UNKNOWN, servers=[{address=localhost:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.ConnectException: Connection refused: connect}}]"}}
Question: Why application status is "DOWN" when my mongodb is not running. I want my application status "UP" weather mongodb is "DOWN" or "UP".
Below is my Main class for spring boot application.
package com.company.testing;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
#SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>SpringBootSample</artifactId>
<version>0.0.1</version>
<name>Spring Boot Sample</name>
<description>Spring Boot Sample for spring boot actuator</description>
<groupId>com.company.testing</groupId>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.3.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
</dependencies>
<properties>
<java.version>1.8</java.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
application.properties
management.health.mongo.enabled=false
endpoints.mongo.enabled=true
MongoDBHealthCheckEndPoint.java
#ConfigurationProperties(prefix = "endpoints.mongo", ignoreUnknownFields = true)
#Component
public class MongoDBHealthCheckEndPoint extends AbstractEndpoint<Map<String, String>>
{
#Inject
MongoTemplate mongoTemplate;
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private static final Map<String, String> UP = new HashMap<String, String>() {{
put("mongo.status", "UP");
}};
private static final Map<String, String> DOWN = new HashMap<String, String>() {{
put("mongo.status", "DOWN");
}};
public MongoDBHealthCheckEndPoint() {
super("mongo", false);
}
public MongoDBHealthCheckEndPoint(Map<String, ? extends Object> mongo) {
super("mongo", false);
}
public Map<String, String> invoke() {
try {
return (new MongoHealthIndicator(mongoTemplate).health().getStatus().equals(Status.UP)) ? UP : DOWN;
} catch (Exception e) {
log.error("mongo database is down", e);
return DOWN;
}
}
Spring Boot Actuator uses HealthIndicatorAutoconfiguration to configure various health related beans. One of the beans is called healthAggregator which uses the implementation or OrderedHealthAggregator. It will use the lowest status of all the health indicators to provide overall application status (that's why you're getting DOWN for overall app.
You can either turn off MongoDb monitoring (management.health.mongo.enabled=false) or write your own implementation of AbstractHealthAggregator that will ignore MongoDb being down for example and provide it in your config:
#Bean
public MyHealthAggregator healthAggregator() {
return new MyHealthAggregator();
}
I'm getting back into the Java world, and I'm trying to configure a new Spring web application with JPA, Hibernate and PostgreSQL.
I have found a lot of older examples with various XML configuration files, and I'm wondering if there is a preferred new way to perform this configuration without relying on XML file authoring.
Some of the things I need to configure are the hibernate sql dialect, driver, etc.
Put the following fragments into a class annotated with #Configuration and #EnableTransactionManagement
Hibernate/JPA (edit the packagesToScan String):
#Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
em.setDataSource(dataSource());
em.setPackagesToScan(new String[] { "com.XY.model" });
JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
em.setJpaVendorAdapter(vendorAdapter);
em.setJpaProperties(additionalProperties());
return em;
}
Properties additionalProperties() {
Properties properties = new Properties();
properties.setProperty("hibernate.hbm2ddl.auto", "update");
properties.setProperty("hibernate.dialect", "org.hibernate.dialect.PostgreSQL9Dialect");
properties.setProperty("hibernate.show_sql", "true");
return properties;
}
DataSource (edit username, password and host address):
#Bean
public DataSource dataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("org.postgresql.Driver");
dataSource.setUrl("jdbc:postgresql://localhost:port/DB_NAME");
dataSource.setUsername("root");
dataSource.setPassword("");
return dataSource;
}
Transaction Manager:
#Bean
public PlatformTransactionManager transactionManager(EntityManagerFactory emf) {
JpaTransactionManager transactionManager = new JpaTransactionManager();
transactionManager.setEntityManagerFactory(emf);
return transactionManager;
}
If you're gonna use spring, i recommend to use Spring Boot which offers many auto configurations. you can use a application.properties for configuring dialects and stuff:
spring.datasource.url = <jdbcurl>
spring.datasource.username = <username>
spring.datasource.password = <password>
spring.datasource.driver-class-name = org.postgresql.Driver
Spring Boot provides a number of Starter Packages that make easy to add jars to your classpath. These Starter Packages simply provide dependencies that you are likely to need when developing a specific type of application. Since you're developing a possibly web application that requires data access, you should add these to your pom.xml:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.1.RELEASE</version>
</parent>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>
</dependencies>
Basically, spring boot tries to guess how you will want to configure your application, based on the jar dependencies that you have added. spring-boot-starter-data-jpa, provides the following key dependencies:
Hibernate — One of the most popular JPA implementations.
Spring Data JPA — Makes it easy to implement JPA-based repositories.
Spring ORMs — Core ORM support from the Spring Framework.
You can explicitly configure JPA settings using spring.jpa.* properties. For example, to create and drop tables you can add the following to your application.properties:
spring.jpa.hibernate.ddl-auto=create-drop
You can read more about spring boot here