Add Spring Mobile Device Resolver autoconfiguration
This commit is contained in:
21
spring-boot-cli/samples/device.groovy
Normal file
21
spring-boot-cli/samples/device.groovy
Normal file
@@ -0,0 +1,21 @@
|
||||
package org.test
|
||||
|
||||
@Controller
|
||||
@EnableDeviceResolver
|
||||
class Example {
|
||||
|
||||
@RequestMapping("/")
|
||||
@ResponseBody
|
||||
public String helloWorld(Device device) {
|
||||
if (device.isNormal()) {
|
||||
return "Hello Normal Device!"
|
||||
} else if (device.isMobile()) {
|
||||
return "Hello Mobile Device!"
|
||||
} else if (device.isTablet()) {
|
||||
return "Hello Tablet Device!"
|
||||
} else {
|
||||
return "Hello Unknown Device!"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user