栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

新建springboot项目

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

新建springboot项目

1.新建springboot项目,详情查看使用IDEA搭建一个简单的SpringBoot项目——详细过程_君当自强-CSDN博客_springboot项目搭建

2.搭建过程中遇到的问题如下:

@RunWith(SpringRunner.class)
@MapperScan("com.example.test")
@ComponentScan(value = "com.example.test.serviceImpl")
@SpringBootTest(classes= DemoApplication.class)
public class TestApplicationTests 
springboot测试启动类不加@RunWith(SpringRunner.class),service注入不进去
不加MapperScan包扫描不到
@SpringBootApplication @MapperScan("com.example.test.mapper") 
public class DemoApplication 
启动类目录位置需要高于controller,不然扫描不到controller
spring:
  datasource:
    name: mysql
    url: jdbc:mysql://localhost:3306/mysql?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC
    username: root
    password: 123
    driver-class-name: com.mysql.jdbc.Driver
    
    

    URL上不加serverTimezone  
报错  The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone. 

springboot内置tomcat端口为8080,访问路径为localhost:8080

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/349634.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号