How to fix: Error creating bean with name : Unsatisfied dependency expressed through field
In your User
class you declare id with int
type
@Id
@Column(name = "id", unique = true)
private int id;
But in the repository interface, you declared Long
public interface UserRepository extends JpaRepository<User, Long> {}
So, in User
class change type of id like,
@Id
@Column(name = "id", unique = true)
private Long id;
And avoid your new error, use @Service
annotation at UserService
interface like
@Service
public interface UserService {
List<User> getUsers();
}
Error creating bean with name 'weatherController': Unsatisfied dependency expressed through field 'weatherService';
In your WeatherRepository
you have:
List<Weather> findByNameContaining(String value);
Now, this is a derived query method (more here).
The problem is your Weather
entity does not have a property named name
which you are using in your method.
The method should be:
List<Weather> findByCityContaining(String value);
Related Topics
How a Jar File Can Read an External Properties File
Looping Within Multiple Arrays in Java Stream
Mockito Mock Objects Returns Null
Why Am I Getting the Error "The Method Is Undefined for the Type"
Java Coding Converted to Pseudo Code
Java Socket Api: How to Tell If a Connection Has Been Closed
How to Find an Object in an Arraylist by Property
How to Sort Date in Descending Order Using Comparator
How to Check Whether an Array Is Null/Empty
How to Print Multiple Variable Lines in Java
Java.Lang.Noclassdeffounderror: Org/Springframework/Core/Env/Configurableenvironment
Java.Lang.Noclassdeffounderror: Lorg/Apache/Logging/Log4J/Logger; But the Artifact Exists
How to Use Variables Declared in Another Class
How to Join Results of Multiple Tables in Spring JPA Repository