SpringBoot入门知识点

 1、使用idea的插件快捷创建springboot项目(根据需要选择不同的依赖)
          spring.io(1、先从官网下载springboot项目 2、导入到idea中  3、根据pom.xml的配置下载依赖)
          
       2、springboot内置了tomcat,springboot可以独立的启动不需要服务,当然内置了tomcat
       
       3、springboot核心配置文件 
          properties:就是一个普通的资源文件构成为:key=value
          yml : key: value (注意每次冒号后要换行,值要空格后在写)
         
       4、springboot项目的html文件默认放在 resources/template目录下
                         静态资源 css/js   resources/static目录下
                        
       5、相关配置
         #端口号
         server:
            port: 8080
         #上下文的配置
            servlet:
              context-path:/demo01
         
         静态文件的路径 /static/
         试图前后缀
            prefix: classpath:resources/template/
            suffix: html            
         
         集成JdbcTemplate
            配置数据源
         
         不同环境的配置切换
           spring:
             profiles:
               active: dev(test)    

          applicat-dev.yml        
          applicat-test.yml         

        6、thymeleaf模板标签的使用
          th:text="${name}" 普通取值 通常放在标签内部 会替换双标签中间的文本值
          [[${name}]]
          th:utext="${name}" 取富文本值
          th:object="${user}"
          th:text="*{username}"
          
          th:each="item,info:${ulist}" 
          
          th:if="${name=='tom'}"  // 隐式转换  数字不为0 都为true 、  字符不为0都为true、 String都是true
                                  //js: undefined null 0 "" 这些都是false
          th:unless="${name=='tom'}" 
          
          <script th:inline="javascript">
             var name = [[${name}]]
          </script>
          
          <a th:href="@{/user/list?name=tom}"></a>
          <a th:href="@{/user/list(name=tom,sex=boy)}"></a>
          <a th:href="@{/user/delete(name=${name},sex=boy)}"></a>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值