• 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

  • 相关阅读:
    2022918 #29 愿灰飞烟灭 我的每个昨天
    2022917 #28 请允许我独自探访这场戏的结局
    2022911/12 #27 自弹 自唱 自赏 不如自封为王
    2022912 #26 新的开始
    EBS:导入弹性域关键字的值(FND_FLEX_LOADER_APIS.up_value_set_value)
    EBS:已知科目组合ID,查询科目组合值
    EBS:值集获取段限定词SQL
    EBS:资产期间状态查询
    Oracle Linux 7u2 启动错误 XFS_WANT_CORRUPTED_GOTO
    EBS:事物处理活动TRANSACTION_ACTION_ID
  • 原文地址:https://www.cnblogs.com/DFX339/p/8880062.html
Copyright © 2020-2023  润新知