首页 > 编程语言 > 详细

spring-boot启动web项目

时间:2020-04-04 01:09:49      阅读:69      评论:0      收藏:0      [点我收藏+]

1.依赖

<parent>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
       <version>1.4.3</version> </parent>
<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-boot-starter-web</artifactId>
       <version>1.4.3</version> </dependency>

2.启动类

@SpringBootApplication
public class SelfApplication {

    public static void main(String[] args) {
        SpringApplication.run(SelfApplication.class, args);
    }

}

3.controller

@RestController
@RequestMapping("fb")
public class DemoController  {

    @RequestMapping(value="hl",method=RequestMethod.GET)
    public String sayHello(List<Long> ids) {
        return "hello";
    }
}

4.集成数据库

<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
      <dependency>
            <groupId>org.mybatis.spring.boot</groupId>
            <artifactId>mybatis-spring-boot-starter</artifactId>
            <version>2.1.1</version>
        </dependency>
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>druid-spring-boot-starter</artifactId>
            <version>1.1.21</version>
        </dependency>
<dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
        </dependency>
项目启动类上添加标注
@MapperScan(value = "xxx.mapper", markerInterface = Mapper.class)


spring-boot启动web项目

原文:https://www.cnblogs.com/yangyang12138/p/12630057.html

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