eclipse-ee4j / eclipse-ee4j/jersey

Spring Example Throws NoSuchMethodException For 'value' on Autowired Annotation

Open
#2,588 6 comments 0 reactions 0 assignees View on GitHub
Component: extensions Priority: Minor spring Type: Bug
Dominant language
Java
Stars
730
Forks
382
PR merge metrics
No merged PRs in 30d

Description

Create a file called 'jul.properties' in the 'jersey/examples/helloworld-spring-webapp' directory with the following contents:

```
handlers=java.util.logging.ConsoleHandler
java.util.logging.ConsoleHandler.level=ALL
java.util.logging.SimpleFormatter.format=%4$-7s [%3$s] %5$s%6$s%n

.level=ALL
org.glassfish.jersey.level=ALL
org.glassfish.jersey.tracing.level=FINEST
```

Run this command:

```
mvn -Djava.util.logging.config.file=jul.properties jetty:run
```

In the logging output observe lines like this:

```
Jan 6, 2014 10:29:11 PM org.glassfish.jersey.server.model.Parameter getValue
FINER: Unable to get the com.sun.proxy.$Proxy35 annotation value property
java.lang.NoSuchMethodException: org.springframework.beans.factory.annotation.Autowired.value()
at java.lang.Class.getMethod(Class.java:1641)
at org.glassfish.jersey.server.model.Parameter.getValue(Parameter.java:458)
...
```

Expected behaviour: example apps shouldn't throw spurious errors.

(Impact of this bug: I have had a long struggle to upgrade a Jersey 1.8 application to Jersey 2.5 and when I encountered this exception I spent quite a while trying to understand and 'fix' it, before I realized that it was expected.)
#### Environment
OS X 10.9.1, Java 7
#### Affected Versions
[2.5.1]

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.