Setting up dependencies and the configuration class

Initially, before implementing the domain model, the dependencies and configuration classes need to be specified. The following Maven starter dependency and H2 database dependency need to be included:

<dependencies>
...
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>

<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.196</version>
</dependency>
</dependencies>

The following RepoConfig is used:

@Configuration
@EnableJpaRepositories(basePackages = "com.packtpub.spring.boot.email.formatter.model")
@EnableTransactionManagement
@EntityScan(basePackages = "com.packtpub.spring.boot.email.formatter.model.domain")
public class RepoConfig {
}

The @EnableJpaRepositories annotation is used to set the base package where repositories are available. @EnableTransactionManagement is used to enable the Spring JPA Transaction Manager. The @EntityScan annotation is used to set the base package where domain entities are available.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.188.66.13