kamaci
kamaci

Reputation: 75257

Spring-Boot Cannot Add Google Guava Dependency

I want to add Guava collections into my application but I couldn't be successful. Here is my pom definition:

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-jersey</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-security</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-thymeleaf</artifactId>
    </dependency>
    <dependency>
        <groupId>org.thymeleaf.extras</groupId>
        <artifactId>thymeleaf-extras-springsecurity4</artifactId>
        <version>2.1.2.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>com.google.guava</groupId>
        <artifactId>guava</artifactId>
    </dependency>

I want to use MultiMap but it cannot see Guava dependencies. On the other hand my IDE suggests me org.jvnet.hk2.component inside Glassfish. However I don't use Glassfish.

How can I add Guava dependency and remove that Glassfish dependency?

Upvotes: 4

Views: 17283

Answers (2)

user1717331
user1717331

Reputation: 111

You need to add spring-context-support as well.

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-context-support</artifactId>
</dependency>

<dependency>
    <groupId>com.google.guava</groupId>
    <artifactId>guava</artifactId>
    <version>19.0</version>
</dependency>

Upvotes: 11

Arunakiran Nulu
Arunakiran Nulu

Reputation: 2099

Looks like version compatibility issues.

Guava default comes with spring boot server , if you need a specific version you have to override the default with specific version.

Upvotes: 2

Related Questions