For comprehensive information about FlexiCore Boot Starter Data JPA please visit our site.
FlexiCore Boot Starter Data JPA is a FlexiCore Module that provides an opinionated Eclipselink JPA registration for spring boot.
Add the flexicore-boot-starter-data-jpa-hibernate dependency using the latest version available from maven central:
<dependency>
<groupId>com.wizzdi</groupId>
<artifactId>flexicore-boot-starter-data-jpa-hibernate</artifactId>
<version>LATEST</version>
</dependency>
annotate your application class or your configuration class with
@EnableFlexiCoreJPAPlugins
you have have to use Spring's PropertiesLauncher to load your application with entities plugins , here is an example for the command line:
java -Dloader.main=com.your.company.YourApplicationClass -Dloader.path=file:/path/to/entities/folder -jar your-application-exec.jar
your application class:
@EnableFlexiCorePlugins
@EnableFlexiCoreJPAPlugins
@SpringBootApplication
public class App {
public static void main(String[] args) {
SpringApplication app = new SpringApplication(App.class);
app.addListeners(new ApplicationPidFileWriter());
ConfigurableApplicationContext context=app.run(args);
}
}
an entity inside an entity plugin:
@Entity
public class TestEntity {
@Id
private String id;
private String name;
@Id
public String getId() {
return id;
}
public <T extends TestEntity> T setId(String id) {
this.id = id;
return (T) this;
}
public String getName() {
return name;
}
public <T extends TestEntity> T setName(String name) {
this.name = name;
return (T) this;
}
}
FlexiCore Boot Starter Data JPA exposes the following configuration options:
name | default value | description |
---|---|---|
flexicore.entities | /home/flexicore/entities/ | location of entities plugins should be the same as the one provided for Dloader.path in the command running the application |