java - 端点无法解析为类型(ws 中的@Endpoint)- Eclipse 编译错误

标签 java spring-boot soap ws

这有点奇怪,或者可能是我遗漏了一些东西。

我正在使用 Spring Boot 应用程序发布 SOAP 端点。下面是pom.xml文件

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> ..................
<parent>
    .............
</parent>
<groupId>com.gd</groupId>
<artifactId>sl</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>sl</name>
<description>Demo project for Spring Boot</description>
<properties>
    <java.version>1.8</java.version>
</properties>
<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <scope>runtime</scope>
        <optional>true</optional>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>wsdl4j</groupId>
        <artifactId>wsdl4j</artifactId>
    </dependency>
</dependencies> ..........plugin and other stuff.

根据教程,我们只需要 wsdl4j 依赖项即可发布 SOAP 端点。

下面是我的端点类 -

@Endpoint
public class UserDetailsEndpoint {

}

这很简单,但是 Eclipse 显示编译错误并且未将 @Endpoint 注释解析为

import org.springframework.ws.server.endpoint.annotation.Endpoint;

Compilation error

可能是什么问题,我缺少什么?

最佳答案

尝试添加此依赖项:

<!-- https://mvnrepository.com/artifact/org.springframework.ws/spring-ws-core -->
<dependency>
    <groupId>org.springframework.ws</groupId>
    <artifactId>spring-ws-core</artifactId>
</dependency>

查找所需依赖项的一种通常成功的方法是简单地搜索“maven <missing-package>”。

在本例中,我搜索“maven org.springframework.ws”并找到了此依赖项。

关于java - 端点无法解析为类型(ws 中的@Endpoint)- Eclipse 编译错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58185825/

相关文章:

java - 实现只包含一个接口(interface)时的两种方法

java - Java 中的字符串操作导致 "String index out of range"

java - spring MVC 中的 404 错误 - "the requested resource not found"用于简单的注册/登录程序

java - Spring-Boot 兼容内存数据库,支持字符串数组(String[])数据类型

java - 使用 URLEndpoint 通过代理的 SOAP 连接

java - 如何使用 Java 使用 rpc 编码的 SOAP Web 服务

java - hibernate java好奇心 - 保存对象后,要保存的对象和已保存的对象都设置了id

java - 如何在 Cloud Foundry 中更改默认 Spring 配置文件 ("cloud")

maven - Spring Boot 和 Maven war 覆盖

java - SOAP 响应正文是没有任何节点的纯文本