From 4c39cc23142e95314a26c447d94458814550d7d0 Mon Sep 17 00:00:00 2001 From: Yanming Zhou Date: Fri, 1 Sep 2023 09:42:30 +0800 Subject: [PATCH] Continue polishing See commit 947e330e9d4cfc537213554f855f6c551e4d3652 See gh-37166 --- .../test/autoconfigure/jdbc/ExampleRepository.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/jdbc/ExampleRepository.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/jdbc/ExampleRepository.java index 76e28fd542..65de496073 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/jdbc/ExampleRepository.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/jdbc/ExampleRepository.java @@ -32,26 +32,26 @@ import org.springframework.stereotype.Repository; * @author Stephane Nicoll */ @Repository -public class ExampleRepository { +class ExampleRepository { private static final ExampleEntityRowMapper ROW_MAPPER = new ExampleEntityRowMapper(); private final JdbcTemplate jdbcTemplate; - public ExampleRepository(JdbcTemplate jdbcTemplate) { + ExampleRepository(JdbcTemplate jdbcTemplate) { this.jdbcTemplate = jdbcTemplate; } @Transactional - public void save(ExampleEntity entity) { + void save(ExampleEntity entity) { this.jdbcTemplate.update("insert into example (id, name) values (?, ?)", entity.getId(), entity.getName()); } - public ExampleEntity findById(int id) { + ExampleEntity findById(int id) { return this.jdbcTemplate.queryForObject("select id, name from example where id =?", ROW_MAPPER, id); } - public Collection findAll() { + Collection findAll() { return this.jdbcTemplate.query("select id, name from example", ROW_MAPPER); }