Type of annotation not applicable to this type of declaration

package com; /** * * @author sunny */ import javax.ejb.Local; public interface BookService { @Local //error here (annotation type not applicable to this kind of declaration) Book createOrUpdate(Book book); void remove(Book book); Book find(Object id); } 
+1
source share
1 answer

Write your local interface as follows:

 package com; public interface BookServiceLocal { Book createOrUpdate(Book book); void remove(Book book); Book find(Object id); } 

Then add the local interface to your EJB class using the annotation:

 package com; import javax.ejb.Local; @Stateless //Or any other type of EJB you want @Local (BookServiceLocal.class) public BookService { Book createOrUpdate(Book book){return null;} void remove(Book book){} Book find(Object id){return null;} } 
+1
source

Source: https://habr.com/ru/post/947968/


All Articles