gpt4 book ai didi

java - 以编程方式创建零件在开普勒中不起作用

转载 作者:行者123 更新时间:2023-12-01 14:23:27 25 4
gpt4 key购买 nike

我正在 Juno 中创建一个 RCP 应用程序。

在该应用程序中,我基于 PartDescriptor 以编程方式创建部件,如下所示。

 MPart part = partService.createPart("discripto.id");
part.setElementId("element.id");

直到 Eclipse 4.2.2 为止它都可以完美运行。

当我尝试在 Eclipse Kepler 中运行相同的代码时,它不会抛出任何异常 View ,如下所示,没有任何控制:

enter image description here

任何人都可以告诉我我在这里缺少什么吗?

最佳答案

发布问题后即可找到答案:

问题:

@PostConstruct 未调用带注释的方法

解决方案:来自Why isn't my @Inject-able/@PostConstruct methods being injected?

There are typically two reasons why injection fails.

Mismatched Annotations: Ensure your bundles use Import-Package with a package version to pull in the standard annotations rather than a Require-Bundle on the javax.annotation bundle.

Import-Package: javax.inject;version="1.0.0",javax.annotation; version="1.0.0"

Unresolvable Injections: The injector attempts to resolve objects in the context. If an object cannot be resolved in the context, and it's not marked as @Optional, then the method will not be injected. The injector does not normally log when such situations occur as it is an expected occurrence.

我的问题是因为第一个。

关于java - 以编程方式创建零件在开普勒中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17359403/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com