小编Wel*_*haf的帖子

是否可以给 EJB 服务调用回调

是否可以创建一个接受回调的 EJB 服务并在调用该服务的客户端上调用它?用例是:将一个大字节数组上传到服务,该服务将解析它并将结果转换为对象并持久化它们。我想通知客户其中哪些步骤已完成。

@Local
public interface MyService {
    Status upload(byte[] content, Callable<Void> onReceived, Calable<Void> onPersisting);
}

@Stateless(name = "MyService")
public class MyServiceImpl extends MyService {
    Status upload(byte[] content, Callable<Void> onReceived, Calable<Void> onPersisting) {
        // Invoke this because all date is transfered to server.
        onReceived.call();
        // Do the parsing stuff ...
        onPersisting.call();
        // Do the persisting stuff ...
        return new Status(...); // Done or failed or such.
    }
}
Run Code Online (Sandbox Code Playgroud)

在客户端上,我传入可调用对象:

Context ctx = ...
MyService service = ctx.get(...);

ctx.upload(bytes, new Callable<void() …
Run Code Online (Sandbox Code Playgroud)

java ejb jakarta-ee

5
推荐指数
1
解决办法
1071
查看次数

使用Hibernate JPA启动Spring Boot Application时出现NoSuchMethodError

我有一个简单的Hello-World Spring Boot应用程序,包含JPA存储库和Hibernate.的pom.xml样子:

...
<properties>
  <springframework.version>1.5.1.RELEASE</springframework.version>
  <validation-api.version>1.1.0.Final</validation-api.version>
  <dbunit.version>2.5.3</dbunit.version>
  <usertype.core.version>6.0.1.GA</usertype.core.version>
  <validate.version>2.2.0</validate.version>
  <strman.version>0.2.0</strman.version>
  <reflections.version>0.9.10</reflections.version>
  <javax.servlet.jsp-api.version>2.3.1</javax.servlet.jsp-api.version>
  <rest-assured.version>3.0.1</rest-assured.version>
</properties>

<dependencyManagement>
    <dependencies>
        <dependency>
            <!-- Import dependency management from Spring Boot -->
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-dependencies</artifactId>
            <version>${springframework.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

<repositories>
    <repository>
        <id>spring-milestone</id>
        <url>https://repo.spring.io/libs-release</url>
    </repository>
</repositories>

<pluginRepositories>
    <pluginRepository>
        <id>spring-milestone</id>
        <url>https://repo.spring.io/libs-release</url>
    </pluginRepository>
</pluginRepositories>

<dependencies>
    <!-- Spring -->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
        <exclusions>
            <exclusion>
                <!-- We use Logback for logging. -->
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-logging</artifactId>
            </exclusion>
            <exclusion>
                <!-- We use Jetty because it is cooler ;) -->
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-tomcat</artifactId> …
Run Code Online (Sandbox Code Playgroud)

java spring hibernate jpa spring-boot

5
推荐指数
1
解决办法
2154
查看次数

标签 统计

java ×2

ejb ×1

hibernate ×1

jakarta-ee ×1

jpa ×1

spring ×1

spring-boot ×1