Kotlin Language Documentation 1.9.20you use JDBC to interact with databases. For convenience, the Spring Framework provides the JdbcTemplate class that simplifies the use of JDBC and helps to avoid common errors. Add database support springframework.stereotype.Service import org.springframework.jdbc.core.JdbcTemplate @Service class MessageService(val db: JdbcTemplate) { fun findMessages(): List= db.query("select * from messages") message.id, message.text) } } Constructor argument and dependency injection – (val db: JdbcTemplate) A class in Kotlin has a primary constructor. It can also have one or more secondary constructors 0 码力 | 1299 页 | 32.44 MB | 1 年前3
Kotlin 1.9.10 官方文档 中文版
you use JDBC to interact with databases. For convenience, the Spring Framework provides the JdbcTemplate class that simplifies the use of JDBC and helps to avoid common errors. Add database support springframework.stereotype.Service import org.springframework.jdbc.core.JdbcTemplate @Service class MessageService(val db: JdbcTemplate) { fun findMessages(): List= db.query("select * from our case, the constructor is (val db: JdbcTemplate) . val db: JdbcTemplate is the constructor's argument: @Service class MessageService(val db: JdbcTemplate) The findMessages() function calls 0 码力 | 3753 页 | 29.69 MB | 1 年前3
Kotlin 官方文档中文版 v1.9you use JDBC to interact with databases. For convenience, the Spring Framework provides the JdbcTemplate class that simplifies the use of JDBC and helps to avoid common errors. Add database support springframework.stereotype.Service import org.springframework.jdbc.core.JdbcTemplate @Service class MessageService(val db: JdbcTemplate) { fun findMessages(): List= db.query("select * from our case, the constructor is (val db: JdbcTemplate) . val db: JdbcTemplate is the constructor's argument: @Service class MessageService(val db: JdbcTemplate) The findMessages() function calls 0 码力 | 2049 页 | 45.06 MB | 1 年前3
共 3 条
- 1













