Error added: 2023-01-29T21:40:32Z
I had this problem, and couldn't understand why as jdbcTemplate was a final field, and was initialised in the constructor. Changing my MVC method from private to public stopped this error. @Controller @RequestMapping("/path") public class MyController { private final JdbcTemplate jdbcTemplate; public MyController(JdbcTemplate jdbcTemplate) { this.jdbcTemplate = jdbcTemplate; } @GetMapping private String get() { getEmail(...); } private Optional<String> getEmail(String username) { SqlRowSet row = jdbcTemplate.queryForRowSet("SELECT email FROM emails WHERE username = ?", username); if (row.next()) { return Optional.of(row.getString("email")); } return Optional.empty(); } to @GetMapping public String get() { getEmail(...); }
If you know the answer, please add your own solution below.
If you don't know, but find out later, please come back and share your answer - there will be other people
struggling with this too.
If you want to be notified via email when this is solved, enter your email address here: