import org.springframework.jdbc.core.JdbcTemplate; >エラー The import org.springframework.jdbc cannot be resolvedJava(268435846) @Controller @RequestMapping("/sample") public class SampleController { public final JdbcTemplate jdbcTemplate; public SampleController(JdbcTemplate jdbcTemplate) { this.jdbcTemplate = jdbcTemplate; } @GetMapping("/test") public String test(Model model) { model.addAttribute("title", "Inquery Form"); return "test"; } }
importがされず、jdbcが使えません。どこがおかしいのでしょうか。
設定ファイルは以下です。
build.gradle
1plugins { 2 id 'org.springframework.boot' version '2.2.6.RELEASE' 3 id 'io.spring.dependency-management' version '1.0.9.RELEASE' 4 id 'java' 5} 6 7group = 'com.example' 8version = '0.0.1-SNAPSHOT' 9sourceCompatibility = '1.8' 10 11configurations { 12 developmentOnly 13 runtimeClasspath { 14 extendsFrom developmentOnly 15 } 16} 17 18repositories { 19 mavenCentral() 20} 21 22dependencies { 23 implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' 24 implementation 'org.springframework.boot:spring-boot-starter-web' 25 developmentOnly 'org.springframework.boot:spring-boot-devtools' 26 testImplementation('org.springframework.boot:spring-boot-starter-test') { 27 exclude group: 'org.junit.vintage', module: 'junit-vintage-engine' 28 } 29} 30 31test { 32 useJUnitPlatform() 33}
回答2件
あなたの回答
tips
プレビュー