我已经尝试过@JdbcTest以下项目结构。
.\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 pom.xml\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 src\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 main\n \xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 java\n \xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 com\n \xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 example\n \xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 Application.java\n \xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 repository\n \xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 DemoRepository.java\n \xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 service\n \xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 DemoService.java\n \xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 resources\n \xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 application.properties\n \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 test\n \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 java\n \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 com\n \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 example\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 ApplicationTests.java\n \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 repository\n \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 DemoRepositoryTests.java\nRun Code Online (Sandbox Code Playgroud)\n\nDemoRepository.java(测试目标)
\n\npackage com.example.repository;\n\nimport org.springframework.jdbc.core.JdbcOperations;\nimport org.springframework.stereotype.Repository;\n\n@Repository\npublic class DemoRepository {\n\n private final JdbcOperations jdbcOperations;\n\n DemoRepository(JdbcOperations jdbcOperations) {\n this.jdbcOperations = …Run Code Online (Sandbox Code Playgroud)