file-->project

Idea快速搭建Springboot项目

Idea快速搭建Springboot项目

删除掉mvnw和mvnw.cmd

Idea快速搭建Springboot项目

application.properties

#连接数据库
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/test?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
spring.datasource.username=root
spring.datasource.password=123
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true


#前端页面的前缀
spring.mvc.view.prefix=/pages/
#前端页面的后缀
spring.mvc.view.suffix=.html

#设置端口号
server.port=8081

创建indexController

package com.zhike.springdemo3.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * author:liuguoxin
 * created time : 2019/4/15 11:00
 */
@Controller
public class IndexController {

    @RequestMapping("/index")
    @ResponseBody
    public String index(){
        return "index";
    }
}

访问http://localhost:8081/index

相关文章:

  • 2021-12-27
  • 2021-10-04
  • 2021-06-24
  • 2021-04-05
  • 2021-12-16
猜你喜欢
  • 2021-08-31
  • 2021-12-14
  • 2021-12-14
相关资源
相似解决方案