运行Java代码(春季)时出现此错误;
错误:(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);
}
答案 0 :(得分:0)
您的Param
导入错误。请改用org.springframework.data.repository.query.Param
。您导入的类不是Annotation,因此是错误。