Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ***************************
- APPLICATION FAILED TO START
- ***************************
- Description:
- Field repo in org.bluedolphin.spring.data.mysql.ActorController required a bean named 'entityManagerFactory' that could not be found.
- Action:
- Consider defining a bean named 'entityManagerFactory' in your configuration.
- @EnableJpaRepositories(basePackages="org.bluedolphin.spring.data.mysql", entityManagerFactoryRef="emf")
- ***************************
- APPLICATION FAILED TO START
- ***************************
- Description:
- Field repo in org.bluedolphin.spring.data.mysql.ActorController required a bean named 'emf' that could not be found.
- Action:
- Consider defining a bean named 'emf' in your configuration.
- #Server details
- server.port=8180
- # Replace with your connection string
- spring.datasource.url=jdbc:mysql://localhost:3307/sakila
- # Replace with your credentials
- spring.datasource.username=root
- spring.datasource.password=password
- spring.datasource.driverClassName=com.mysql.jdbc.Driver
- @SpringBootApplication
- @EnableJpaRepositories(basePackages="org.bluedolphin.spring.data.mysql", entityManagerFactoryRef="emf")
- public class SpringDataMysqlApplication {
- private static final Logger log = LoggerFactory.getLogger(SpringDataMysqlApplication.class);
- public static void main(String[] args) {
- SpringApplication.run(SpringDataMysqlApplication.class, args);
- }
- }
- @Entity
- @Table(name = "actor")
- public class Actor {
- @Id
- @GeneratedValue(strategy=GenerationType.AUTO)
- private long id;
- private String first_name;
- private String last_name;
- private Date last_update;
- public Actor(int id, String first_name, String last_name, Date last_update) {
- super();
- this.id = id;
- this.first_name = first_name;
- this.last_name = last_name;
- this.last_update = last_update;
- }
- public Actor() {
- super();
- }
- public long getId() {
- return id;
- }
- public void setId(long id) {
- this.id = id;
- }
- public String getFirst_name() {
- return first_name;
- }
- public void setFirst_name(String first_name) {
- this.first_name = first_name;
- }
- public String getLast_name() {
- return last_name;
- }
- public void setLast_name(String last_name) {
- this.last_name = last_name;
- }
- public Date getLast_update() {
- return last_update;
- }
- public void setLast_update(Date last_update) {
- this.last_update = last_update;
- }
- @Override
- public String toString() {
- return "Actor [id=" + id + ", first_name=" + first_name + ", last_name=" + last_name + ", last_update="
- + last_update + "]";
- }
- }
- public interface ActorRepository extends CrudRepository<Actor, Long> {
- }
- <?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>
- <groupId>org.bluedolphin.spring.data.mysql</groupId>
- <artifactId>spring-data-mysql</artifactId>
- <version>0.0.1-SNAPSHOT</version>
- <packaging>jar</packaging>
- <name>spring-data-mysql</name>
- <description>spring-data-mysql</description>
- <parent>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-parent</artifactId>
- <version>2.0.0.BUILD-SNAPSHOT</version>
- <relativePath/> <!-- lookup parent from repository -->
- </parent>
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- <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-thymeleaf</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>
- <build>
- <plugins>
- <plugin>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-maven-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
- <repositories>
- <repository>
- <id>spring-snapshots</id>
- <name>Spring Snapshots</name>
- <url>https://repo.spring.io/snapshot</url>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- </repository>
- <repository>
- <id>spring-milestones</id>
- <name>Spring Milestones</name>
- <url>https://repo.spring.io/milestone</url>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </repository>
- </repositories>
- <pluginRepositories>
- <pluginRepository>
- <id>spring-snapshots</id>
- <name>Spring Snapshots</name>
- <url>https://repo.spring.io/snapshot</url>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- </pluginRepository>
- <pluginRepository>
- <id>spring-milestones</id>
- <name>Spring Milestones</name>
- <url>https://repo.spring.io/milestone</url>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </pluginRepository>
- </pluginRepositories>
- </project>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement