Я получаю ошибки при создании приложения с использованием maven, как показано ниже:
Ошибка:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name '***Controller': Unsatisfied dependency expressed through field '***ServiceImpl'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name '***ServiceImpl': Unsatisfied dependency expressed through field '***Repository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '***Repository': Post-processing of merged bean definition failed; nested exception is java.lang.NoSuchMethodError: javax.persistence.PersistenceContext.synchronization()Ljavax/persistence/SynchronizationType;
найдите классы, как показано ниже:
Класс контроллера:
@Controller
public class UserController {
@Autowired
private UserServiceImpl userServiceImpl;
------
}
Класс обслуживания:
@Service
public interface UserService {
----
}
Класс обслуживания:
@Service
public class UserServiceImpl implements UserService {
@Autowired
private UserRepository userRepository;
------
}
Класс хранилища:
@Repository
public interface UserRepository extends JpaRepository<User, String>{
@Query(value = "SELECT Number FROM User where Token = :token", nativeQuery=true)
public String findNumber(@Param("token") String token);
}
Класс сущности:
@Entity
public class User {
@Id
@XmlElement(name = "Number")
protected String number;
@XmlElement(name = "Token", required = true)
protected String token;
//setter & getters
}
Может кто-нибудь подсказать, пожалуйста.