spring-mobile 获取device 的两种方法

     第一种:传HttpServletRequest 获取

@GetMapping("/test")

public void home2(HttpServletRequest request){


    

 LiteDeviceResolver deviceResolver = new LiteDeviceResolver();

Device device = deviceResolver.resolveDevice(request);

System.out.println(device);

}     

       


 第2种:

@GetMapping("/")

public void home(Device device){

        System.out.println(device);

    }    

你可能感兴趣的:(其他杂项)