首页 > 编程语言 > 详细

使用idea搭建一个简单的SpringBoot项目

时间:2021-06-27 17:10:32      阅读:25      评论:0      收藏:0      [点我收藏+]

创建项目:

技术分享图片

 

下一步:

Web下勾选Spring Web、Spring Web Services

技术分享图片

 

 

 

Template Englines勾选Thymeleaf

技术分享图片

 

 

 

SQL勾选:MS SQL Server Driver、JDBC API   、 MyBatis Framework三项;点击next;

技术分享图片

 

 

点击Finish

完成后的目录结构:

技术分享图片

 

在templates文件下新建index.html页面,作为启动的初始页面

技术分享图片

 

 

在在com.example.demo下新建controller文件夹建立文件夹controller

技术分享图片

 

 

在controller文件夹下建一个简单的helloController类;(Controller类要添加@Controller注解,项目启动时,SpringBoot会自动扫描加载Controller)

 

技术分享图片

 

 

 

package com.example.demo.controller;

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

@Controller
public class HelloController {
    @RequestMapping("/index")
    public String sayHello() {
        return "index";
    }
}

 

 

 

在resources文件夹下application中先配置DataSource基本信息

 

使用idea搭建一个简单的SpringBoot项目

原文:https://www.cnblogs.com/wfy680/p/14940640.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!