[SpringBoot2.4.3] CRUDのdelete

html

		<form method="post" action="/delete" th:object="${formModel}">
		<input type="hidden" name="id" th:value="*{id}">
		<tr>
			<td><p th:text="|名前: *{name}|"></p></td>
		</tr>
		<tr>
			<td><p th:text="|年齢: *{age}|"></p></td>
		</tr>
		<tr>
			<td><p th:text="*{mail}"></p></td>
		</tr>
		<tr>
			<td><p th:text="*{memo}"></p></td>
		</tr>
		<tr>
			<td><input type="submit" value="delete"/></td>
		</tr>
		</form>

controller

	@RequestMapping(value="/delete/{id}", method=RequestMethod.GET)
	public ModelAndView delete(@PathVariable int id,
			ModelAndView mav) {
		mav.setViewName("delete");
		mav.addObject("title", "delete mydata.");
		Optional<MyData> data = repository.findById((long)id);
		mav.addObject("formModel",data.get());
		return mav;
	}
	
	@RequestMapping(value = "delete", method=RequestMethod.POST)
	@Transactional(readOnly=false)
	public ModelAndView remove(@RequestParam long id,
			ModelAndView mav) {
		repository.deleteById(id);
		return new ModelAndView("redirect:/");
	}

ほう、