Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/307.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
错误:(15,30)java:不兼容的类型:com.sun.research.ws.wadl.Param无法转换为java.lang.annotation.annotation_Java_Angular_Spring Boot - Fatal编程技术网

错误:(15,30)java:不兼容的类型:com.sun.research.ws.wadl.Param无法转换为java.lang.annotation.annotation

错误:(15,30)java:不兼容的类型:com.sun.research.ws.wadl.Param无法转换为java.lang.annotation.annotation,java,angular,spring-boot,Java,Angular,Spring Boot,我在运行java代码(spring)时遇到了这个错误 错误:(15,30)java:不兼容的类型:com.sun.research.ws.wadl.Param无法转换为java.lang.annotation.annotation “电子邮件”和“密码”带有下划线并显示错误,这是我的代码: import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repos

我在运行java代码(spring)时遇到了这个错误

错误:(15,30)java:不兼容的类型:com.sun.research.ws.wadl.Param无法转换为java.lang.annotation.annotation

“电子邮件”和“密码”带有下划线并显示错误,这是我的代码:

import org.springframework.data.jpa.repository.JpaRepository;

import org.springframework.data.jpa.repository.Query;
import com.sun.research.ws.wadl.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import org.springframework.data.rest.core.annotation.RestResource;
import org.springframework.web.bind.annotation.RequestParam;

@RepositoryRestResource(path = "/test", collectionResourceRel = "test")
public interface JpaService extends JpaRepository<Person, Long> {

@RestResource(exported = false)
@Query("SELECT p FROM Person AS p WHERE p.email =:email AND p.password =:password")
public Person login(@Param("email") String email , @Param("password")String password);

@RestResource(exported = false)
@Query("SELECT p FROM Person AS p WHERE p.email =:email")
public Person getPersonByEmail(@Param("email") String email);


}
import org.springframework.data.jpa.repository.JpaRepository;
导入org.springframework.data.jpa.repository.Query;
导入com.sun.research.ws.wadl.Param;
导入org.springframework.data.rest.core.annotation.RepositoryRestResource;
导入org.springframework.data.rest.core.annotation.RestResource;
导入org.springframework.web.bind.annotation.RequestParam;
@RepositoryRestResource(path=“/test”,collectionResourceRel=“test”)
公共接口JpaService扩展了JpaRepository{
@RestResource(导出=假)
@查询(“从Person中选择p作为p,其中p.email=:email和p.password=:password”)
公众登录(@Param(“email”)字符串电子邮件,@Param(“密码”)字符串密码);
@RestResource(导出=假)
@查询(“从Person中选择p作为p,其中p.email=:email”)
公众人物getPersonByEmail(@Param(“电子邮件”)字符串电子邮件);
}

您的
参数导入错误。改用
org.springframework.data.repository.query.Param
。您导入的类没有注释,因此出现错误。

我怀疑您使用了错误的导入。删除行
import com.sun.research.ws.wadl.Param并查看其他导入建议,它可能是spring的类之一。不客气。如果它回答了你的问题,那么你可能想接受它作为正确答案和/或投票。看见