Attribute value must be a constant.

package spittr.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import spittr.data.SpittleRepository;

import static org.springframework.web.bind.annotation.RequestMethod.GET;

@Controller
@RequestMapping ( "/spittles" )
public class SpittleController {

    private SpittleRepository spittleRepository;
    private static final String MAX_LONG_AS_STRING = Long.toString(Long.MAX_VALUE) + "";

    @Autowired
    public SpittleController(SpittleRepository spittleRepository) {
        this.spittleRepository = spittleRepository;
    }

    @RequestMapping ( method = GET )
    public String spittles(
            Model model,
            @RequestParam ( value = "max", defaultValue = SpittleController.MAX_LONG_AS_STRING) long max,
            @RequestParam ( value = "count", defaultValue = "20" ) int count) {
        model.addAttribute(
                "spittleList",
                spittleRepository.findSpittles(max, count)
        );
        return "spittles";
    }
}
The default value in

@ RequestParam prompts an error attribute value must be a constant. when passing Max _ LONG_AS_STRING But I have set MAX_LONG_AS_STRING to static above, why do you still remind me of this? On the contrary, if I set the top to

private static final String MAX_LONG_AS_STRING = "50";

there will be no error.

Why is this solved? If the principle during compilation and running is involved, I hope the boss will answer in detail.

Mar.03,2021

well, I found the answer. https://www.jianshu.com/p/f24.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e78d5b-70f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e78d5b-70f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?