jdbc:
url: jdbc:mysql://localhost:3306/blogdb?useUnicode=true&characterEncoding=utf-8
@Service
public class JDBCService {
@Value('@{jdbc.url}') // spel 表达式
private String url ;
public String getJDBCUrl() {
return this.url;
}
}
@RestController
public class JDBCController{
@Autowired
private JDBCService jdbcService ;
@RequestMapping("/jdbcUrl")
public String jdbcUrl() {
return jdbcService.getJDBCUrl();
}
}
手写,没验证,反正大概就这样