1

I am using spring boot 2.0 + in my project ,I want to use device resolver for spring boot but ,I guess for 2.0 device resolver has been removed ,any idea how to do that ?? ,I searched web but did'nt get any answer ,I followed this link-

Detecting a mobile device with spring-boot

But could'nt work out

Pawan Tiwari
  • 518
  • 6
  • 26

2 Answers2

1

There is no spring-mobile-starter for Spring Boot 2.x, and it looks like development has stopped.

https://github.com/spring-projects/spring-mobile

Your only real options are,

  • Revert to the 1.5.x spring boot release line
  • Use the 2.x Milestone, this was never released and requires the spring milestone repository - it is not updated for 2.1 so may run into issues.
  • Get involved with the repository and provide a PR upgrading it to 2.x

You could also try raising an issue on the repository and asking what the status of the project is.

If you want to try the Milestone add the following to your POM.

<dependencies>
    <dependency>
        <groupId>org.springframework.mobile</groupId>
        <artifactId>spring-mobile-starter</artifactId>
        <version>2.0.0.M2</version>
    </dependency>
</dependencies>

<repositories>
    <repository>
        <id>spring-milestones</id>
        <name>Spring Milestones</name>
        <url>https://repo.spring.io/milestone</url>
    </repository>
</repositories>
Darren Forsythe
  • 10,712
  • 4
  • 43
  • 54
  • ok ,but reverting back to 1.5 wont cause any issue? like i am using thymeleaf for my project with springboot starter parent 2.0.4.RELEASE,would it be good if i change version here or i have to do other changes too? –  Nov 03 '18 at 16:39
  • Spring Boot 2.x introduced some fairly sweeping changes across the board and dependency upgrades it is a breaking change, I can't state there might not be a few issues downgrading depending what APIs you have used. Spring Boot 1.5.x is also end of life in August 2019 too; so it might only be a temporary solution to downgrade. You cannot manage individual dependencies like that with Spring without hitting some major run time exceptions. e.g. you cannot keep Thymeleaf 2.x and downgrade the rest to 1.5.x – Darren Forsythe Nov 03 '18 at 16:53
0

You Can Use Scientia Mobile API.

For this, you need the User-Agent to detect the info related device info

String userAgent = request.getHeader("User-Agent");

The header looks like this:

User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.13) Gecko/2009073021 Firefox/

https://docs.scientiamobile.com/documentation/onsite/onsite-java-api

Wai Ha Lee
  • 8,598
  • 83
  • 57
  • 92
Nabeel Ahmed
  • 258
  • 1
  • 7
  • 23