mirror of
https://github.com/jlengrand/Exposed.git
synced 2026-03-10 08:11:20 +00:00
Exposed Spring Boot Starter
This is a starter for Spring Boot to utilize Exposed as the ORM instead of Hibernate
Getting Started
This starter will give you the latest version of Exposed and the spring-transaction library along with Spring Boot Data Starter JDBC
Maven
<repositories>
<repository>
<id>jcenter</id>
<name>jcenter</name>
<url>http://jcenter.bintray.com</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.jetbrains.exposed</groupId>
<artifactId>exposed-spring-boot-starter</artifactId>
<version>0.16.1</version>
</dependency>
</dependencies>
Gradle
repositories {
jcenter()
}
dependencies {
implementation 'org.jetbrains.exposed:exposed-spring-boot-starter:0.16.1'
}
Setting up a database connection
This starter utilizes spring-boot-starter-data-jdbc so all properties that you are used to for setting up a database in spring are applicable here.
application.properties (h2 example)
spring.datasource.url=jdbc:h2:mem:testdb
spring.datasource.driverClasName=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=password
Automatic Schema Creation
This starter will create the database schema if enabled automatically using any class that extends org.jetbrains.exposed.sql.Table
Sometimes you will want to exclude packages from that list, we have included the property spring.exposed.excluded-packages which will exclude everything under the provided package
application.properties
spring.exposed.generate-ddl = true
spring.exposed.excluded-packages = com.example.models.ignore,com.example.utils