how resolve error org.springframework.beans.factory.UnsatisfiedDependencyException?

Viewed 973

I work on spring project. How i do grable build a get errors. How i can resolve this errors?

Errors

Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException at ConstructorResolver.java:800Caused by: org.springframework.beans.factory.BeanCreationException at ConstructorResolver.java:658 Caused by: org.springframework.beans.BeanInstantiationException at SimpleInstantiationStrategy.java:185 Caused by: org.springframework.boot.context.properties.bind.BindException at Binder.java:363 Caused by: java.lang.IllegalStateException at JavaBeanBinder.java:366 Caused by: java.lang.reflect.InvocationTargetException at NativeMethodAccessorImpl.java:-2 Caused by: java.lang.RuntimeException at HikariConfig.java:486 Execution failed for task ':test'. > There were failing tests. See the report at: file:///C:/Users/dschekmazov/Desktop/RestCMS-main/build/reports/tests/test/index.html

Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

...

I make 4 models classes for db.

package restboot.rest.models;

import javax.persistence.*;
import javax.persistence.Table;

@Entity
@Embeddable
@Table(name = "category")
public class Category {
    @Id
    @Column(name = "id_c")
    private int id;
    @Column(name = "parentid_c")
    private String parentId;
    @Column(name = "name_c")
    private String name;

    public Category() {
    }

    public Category(int id, String parentId, String name) {
        this.id = id;
        this.parentId = parentId;
        this.name = name;
    }

    public Category(String parentId, String name) {
        this.parentId = parentId;
        this.name = name;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getParentId() {
        return parentId;
    }

    public void setParentId(String parentId) {
        this.parentId = parentId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}

....

And 4 repo classes

package restboot.rest.repo;

import org.springframework.data.repository.CrudRepository;
import restboot.rest.models.Category;

public interface CategoryDB extends CrudRepository<Category, Integer>{}

...

And 4 controller classes

package restboot.rest.controllers.front;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

@Controller
public class Home {
    @GetMapping("/")
    public String getHome(Model model){
        return "home";
    }
}

.....

And

package restboot.rest;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class RestApplication {
    public static void main(String[] args) {
        SpringApplication.run(RestApplication.class, args);
    }
}

And applecation.properties

spring.datasource.url=jdbc:mysql://localhost:3305/rest
spring.datasource.username=root
spring.datasource.password=toor
spring.datasource.type=com.zaxxer.hikari.HikariDataSource

spring.datasource.hikari.minimumIdle=5
spring.datasource.hikari.maximumPoolSize=20
spring.datasource.hikari.idleTimeout=30000
spring.datasource.hikari.maxLifetime=2000000
spring.datasource.hikari.poolName=SpringBootJPAHikariCP
spring.datasource.hikari.connectionTimeout=30000

spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.show_sql=true
spring.jpa.properties.hibernate.format_sql=true
spring.jpa.properties.hibernate.use_sql=true
spring.jpa.properties.hibernate.id.new_generator_mappings=false
spring.jpa.properties.hibernate.default_schema=dbschema
spring.jpa.properties.hibernate.search.autoregister_listeners=false
spring.jpa.properties.hibernate.bytecode.use_reflection_optimizer=false
0 Answers
Related