facebook

How to ‘activate’ @Resource annotation

  1. MyEclipse IDE
  2.  > 
  3. Java EE Development (EJB, JSP, Struts, XDoclet, etc.)
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #271195 Reply

    sbirnie
    Member

    I’m relatively new to Java 5. I’m using MyEclipse v5.5.1 GA.

    I’m trying to add a @Resource(name=”myBean”) annotation to my class, but i get an error of “Resource cannot be resolved to a type”.

    I found the Pitchfork project, but what do I need to do to enable @PostCostruct, @PreDestroy, and @Resource in the editor/compiler?

    #271197 Reply

    sbirnie
    Member

    FYI – I found Pitchfork because the application is using the Spring framework, so I thought they’d work together. [ulr=http://www.interface21.com/pitchfork]Pitchfork Homepage[/url]

    #271202 Reply

    Riyad Kalla
    Member

    Annotations are just like classes. You need to make sure that the libraries (JARs) that contain them are in your build path, then using @Resource will create an import for the Resource annotation for you.

    Also you need to make sure your project has Java 5 compiler settings turned on (under project preferences, under Java compiler) and make sure you have atleast Java 5 JRE added to your project’s build path (under Project Properties > Java Build Path > Libraries).

    #271204 Reply

    sbirnie
    Member

    Thanks – that help out a lot. I know I was compiling w/Java 5 because I was using generics and other spring annotations, but I didn’t have the MyEclipse ‘Java EE 5 Libraries’ in my build path.

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: How to ‘activate’ @Resource annotation

You must be logged in to post in the forum log in