Injektion von EPartService

Ich entwickle eine e4-Anwendung. Ich möchte EPartService außerhalb des Teils und des Handlers injizieren, wenn ich EPartService injiziere, dann erhalte ich einen Nullzeigerfehler

  public class DisplayRuntimePart {
          @Inject  EPartService partService;
          private void displayPart(){
          MPart part=partService.findPart("com.rcpe4.myproject.part.datapart");                   
          mpart.setVisible(true);
          partService.showPart(mpart, PartState.CREATE);   
    }
  }

Ich lese auch diese Frage, aber bis nicht mein Problem lösen E4 EPartService findPart () löst java.lang.Null Pointer Exception aus

Bearbeite Ich spritze EPartService in Teileklasse. Die Klassen-URI in Application.e4xml lautet bundleclass: //com.abc.test/com.abc.test.part.MyPart In dieser Klasse schreibe ich Code wie folgt:

      Class Mypart{ 
          @Inject EPartService prtservice;                  
          @Inject
          public MyPart() {
          } 
          @PostConstruct
          public void postConstruct(Composite parent) {
             parent.setLayout(new  FillLayout(SWT.HORIZONTAL));     
             htmlBrowser = new Browser(parent, SWT.NONE);

         }  
         @PreDestroy
        public void preDestroy() {

        }   
        @Focus
        public void onFocus() {

        }   
        @Persist
        public void save() {

        } 
         public dispalyPart(){  
                MPart mpart=partService.findPart("com.abc.test.part.datapart"); **Here Getting Null Pointer Exception**
                mpart.setVisible(true);
                partService.showPart(mpart, PartState.CREATE);  
        }
   }

Antworten auf die Frage(1)

Ihre Antwort auf die Frage