アプリケーションでモバイル デバイスを検出してそのページをレンダリングしようとしていますが、応答がありませんが、index.html ページはレンダリングされています。モバイルコントローラーを完全に無視しています。
@Controller
public class DeviceDetection {
@RequestMapping("/")
public @ResponseBody String detectDevice(Device device) {
if (device.isNormal()) {
System.out.println("Inside isNormal()");
return "index";
} else if (device.isMobile()) {
System.out.println("Inside isMobile()");
return "mobilePage";
} else if (device.isTablet()) {
return "mobilePage";
}
return "index";
}
}
pom.xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mobile</artifactId>
</dependency>