zoukankan      html  css  js  c++  java
  • SpringBoot document notes

    图片拷贝不过来,直接从github上下载 。

    链接: https://github.com/DFX339/SpringBootDocumentNotes.git

    Create a example

    pom.xml

    Controller:

    The defferent between @RestController  and  @Controller:

    @Controller  could return jsp、html or   (add @ResponseBody to return json)json

    @RestController just could return json.

    @RestController  = @Controller +@ResponseBody

    @EnableAutoConfiguration: aim to tell springboot how to configure spring.

    Main method: to auto starting spring,auto starting the tomcat web server.

    When you see that your demo is successful.

    @SpringBootApplication on you main class.

    Locate you  main class above other clasese package.

    @SpringBootApplication = @EnableAutoConfiguration +@ComponentScan

    Main class demo  with use the @SpringBootApplication

    @Configuration: load one class

    @Import : load one special class

    @ComponentScan: load all spring conponent.

    @Configuration to configure xml

    @Configuration :Recommend this annotations

    @EnableAutoConfiguration : use this could auto configuration

    @EnableAutoConfiguration : to Ingnore some class

    @ComponentScan : find  you beans

    @Autowired: inject object by constructor.

    Structrue codes to use @ComponentScan:

    @Repository:always use to annotation the Dao

    Default configure file name. application.properties

    @SpringBootApplication = @EnableAutoConfiguration + @Configuration + @ComponentScan

    Use @EnableAutoConfiguration @Configuration @Import to annotation main class instead of @SpringBootApplication   demo.

    @Import : point at some specific classes.

    @Component: point at all class.

    Springboot-devtools: A powerrful dependency!

    Disable to cache in default.

    If some files be modified ,the springboot- devtool will restart this program auto.

    Restart detailed analysis: springboot worked with two classloaders.

    Restart logs: you can figure out it by configuring in application.properties.

    spring.devtools.restart.log-condition-evaluation-delta=false

    Eclude some files ,project would not to restart when they are changed

    Springboot devtool default to start,you can stop it by modifying the System param.

    Trigger a brower refresh. (auto)

    Use the configure file name definitied by self. Composed with –spring.config.name=Xxxxxx

    Use specific configuration

    @EnableConfigurationProperties:all class be annotated by @ConfigurationProperties

    Use @Valitaded  anotations to validate attributes

    Ouput the log fiiles

    Springboot support tomcat/jetty ,the default port is 8080

    Springboot servlet

    Use springboot servlet

    Configure springboot servlet in application.properties

    Demo in springboot servlet

    Modify the port in tomcat

    Connect to mysql database;

    Tomcat connect pool

    Entity Class use @Entity annotations

    JOOQ: java object orentied query

    Springboot user redis

    Connect redis

    Springboot provides lots of databases,sql or nosql ,all of those will have XXXTemplate instance to operate.

    Springboot cache use demo:

    JMS: java message service

    JMS-ActionMq:use demo:

    JMS send meassages:

    RabbitMQ

    Send mesages:

    Receive messages:

    Use restTemplate by RestTemplateBuilder

    Use webClient by WebClientBuilder

    Springboot use quartz scheduler

    50.5

  • 相关阅读:
    Codeforces Round #321 (Div. 2) D. Kefa and Dishes 状压dp
    Codeforces Round #406 (Div. 2) D. Legacy 线段树建模+最短路
    HDU 4897 Little Devil I 树链剖分+线段树
    HDU 5405 Sometimes Naive 树链剖分+bit*****
    HDU 5274 Dylans loves tree 树链剖分+线段树
    BZOJ 2243: [SDOI2011]染色 树链剖分+线段树区间合并
    HDU 5544 Ba Gua Zhen dfs+高斯消元
    HDU 3949 XOR 线性基
    BZOJ 2460: [BeiJing2011]元素 线性基
    Educational Codeforces Round 18 C. Divide by Three DP
  • 原文地址:https://www.cnblogs.com/DFX339/p/8880062.html
Copyright © 2011-2022 走看看