Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistency in spring-boot-starter-jersey #15365

Closed
raphw opened this issue Dec 1, 2018 · 6 comments
Closed

Inconsistency in spring-boot-starter-jersey #15365

raphw opened this issue Dec 1, 2018 · 6 comments
Labels
for: external-project For an external project and not something we can fix

Comments

@raphw
Copy link

raphw commented Dec 1, 2018

A simple project with the single dependency

<dependencies>
  <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-jersey</artifactId>
    <version>2.1.1.RELEASE</version>
  </dependency>
</dependencies>

with

@SpringBootApplication
public class SampleApp {
    public static void main(String[] args) {
        SpringApplication.run(SampleApp.class);
    }
}

will fail to start with the error:

java.lang.NoSuchMethodError: org.springframework.aop.framework.AopProxyUtils.getSingletonTarget(Ljava/lang/Object;)Ljava/lang/Object;

It seems like the Jersey dependency is dragging ing Spring 4 via the HK2 bridge what causes an inconsistency with Spring Boot that is using Spring 5.

@raphw raphw changed the title Inconsistency in spring-boot-jersey Inconsistency in spring-boot-starter-jersey Dec 1, 2018
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Dec 1, 2018
@snicoll
Copy link
Member

snicoll commented Dec 2, 2018

@raphw thanks for the report but there's not much we can do if you're not using proper dependency management for the project (You can generate an app with jersey on start.spring.io and it won't drag Spring 4). There isn't a jersey-spring5 integration at the moment and it would be nice if Jersey aligned. Please cast your vote on eclipse-ee4j/jersey#3736

@snicoll snicoll closed this as completed Dec 2, 2018
@snicoll snicoll added for: external-project For an external project and not something we can fix and removed status: waiting-for-triage An issue we've not yet triaged labels Dec 2, 2018
@wilkinsona
Copy link
Member

Judging by the version on the dependency, am I right to assume that you aren’t using Spring Boot’s dependency management? If you’re not using it, is there something that prevents you from doing so?

@raphw
Copy link
Author

raphw commented Dec 2, 2018

I am not using it in this case as I am integrating against a legacy code base where I need to be a bit particular with it which is why I decided to start of with running my own BOM.

I was under the impression that any Spring Boot Maven dependency would declare its own needed dependencies in a way that they can be used out-of-the-box, e.g. by explicitly excluding the Spring 4 dependency and including the Spring 5 bridge instead. I found that a bit surprising to learn but thanks for the explanation.

@snicoll
Copy link
Member

snicoll commented Dec 2, 2018

You can have your own bom and import ours. Alternatively you can provide dependency management for the bits that you need. You could import spring-framework-bom for a start.

But I highly encourage you to import our bom if you can.

@raphw
Copy link
Author

raphw commented Dec 2, 2018

I'd do that but I integrate against a bunch of infrastructure code that is compiled against outdated versions of everything. Eventually, I'd like to use the Spring BOM but as a first step, I wanted to drag in isolated Spring dependencies and find some common ground.

It's not a problem once you know the issue, I was just surprised that I could not create a single-Spring-only-dependency project without Spring dependency management. Intuitively, I found that to be a bug which could be solved by setting the dependency in the starter POM.

@ankurpathak
Copy link

ankurpathak commented Mar 27, 2019

@snicoll We have the issue related to spring 5 support moving but we need help from Spring Team.
So can you please help for:
eclipse-ee4j/jersey#4062
and related to this:
eclipse-ee4j/jersey#4080

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: external-project For an external project and not something we can fix
Projects
None yet
Development

No branches or pull requests

5 participants