Spring Boot 基础 二

一。Spring Boot 核心

   (1)基本配置

                  【

                        1.@SpringBootApplication(组合@Configuration,@EnableAutoConfiguration,@ComponentScan

                        2. 配置文件{

                                       1.在resources or config 目录下添加xxx.properties

                                        2.starter pom

                                        3.第三方starter pom

                                       4..XML配置

                                 }

                       3.外部配置{

                                     1.命令行参 (Java -jar xx.jar --server.port=9090) 

                             }

                       4.日志配置{

                                    1.配置日志级别

                                     2.配置日志文件

                               }

                       5.Profile配置{

                                    eg:spring.profiles.active=profile,   在新建appliacation-{profile}.properties

                           }

                   】

二。Spring Boot的web开发

               【

                       (1)Thymeleaf模板引擎

                                【

                                       1.引入Thymeleaf

                                        2.访问model中的数据(${ })

                                        3.model中的数据迭代(th:each=“xx:${  }”)

                                         4.数据判断(th:if="${ } ")

                                        5.在JavaScript中访问model(通过th:line=“JavaScript”添加标签,通过[[${ }]]获取值)

                                 】

                      (2)与Spring MVC集成(通过ThymeleafViewResolver()or  ThymeleafView)

                      (3)Spring Boot的Thymeleaf支持(通过thymeleaf包)

                      (4)Web相关配置

                             【

                                 1.Spring Boot提供的自动配置(ViewResolver,自动配置的静态资源,Formatter和Converter,HttpMessageConverters,静态首页支持)

                                        2.SSL(server.ssl.key-store=.keystore)

                                        3.Favicon(Spring.mvc.favicon.enabled=false)

                                     】

                   (5)WebSocket

                             【

                                    1.广播式

                                                【1.配置webscokt  

                                                     2.浏览器向服务端发送消息类

                                                     3.服务端向浏览器发送消息类

                                                     4.控制器

                                                     5.添加脚本

                                                     6.演示页面

                                                      7.配置viewController

                                         】

                               2.点对点式   (配置WebSocket,增加一个消息代理)

                     】

三。Spring Boot 数据访问

                   【

                         (1)Spring Data JPA{

                                         1.继承JpaRepository

                                         2.配置@EnableJpaRepositories开启支持

                                         3.接口定义方法(eg:

                                                                     List<Person> findByName(String name)(属性名查询)

                                                                     or  @NamedQuery or  @Query or Specification)

                                  }

                           (2)自定义Repository{

                                         1.定义Repository接口

                                          2.定义接口实现

                                          3.自定义RepositoryFactoryBean

                                       }

                              (3)Spring Data REST(repository转化成REST服务){

                                         1.继承方式   RepositoryRestMvcConfiguration

                                          2.导入方式  @Import(RepositoryRestMvcConfiguration.calss)

                               }          

                               (4)声明式事务{

                                            1.Spring的事务机制(JDBC,JPA,Hibernate,JDO,分布式事务)

                                            2.声明式事务(propagationtion,isolation,timeout,readOnly,rollbackFor,noRollbackFor)

                                       }

                               (5)数据缓存{

                                              1.CacheManager

                                               2.Cache

                                               3.EhCache

                                               4.Guava

                                               5.Redis

                                              }

                   】

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值