Springboot入門學習筆記 一

2021-08-15 15:31:31 字數 1104 閱讀 9431

springboot的配置檔案和基本的一些注釋

可以在這裡選擇用哪個檔案

spring:

profiles:

active: dev

server:

port: 8080

context-path: /girl

girl:

cupsize: b

age: 20

server:

port: 8081

context-path: /girl

girl:

cupsize: f

age: 20

content: "cupsize: $,age: $"

@value("$")

private string cutsize;

@configurationproperties(prefix = "girl")

@component

public

class

girlproper {

private string cupsize;

private integer age;

@component用於bean這個類.

prefix = "girl"指此類用於yml裡字首是girl的屬性。

public string say(@pathvariable("ip") integer ip) {

integer i = ip;

public string say(@requestparam(value = "ip" ,defaultvalue = "110",required = false) integer ip) {

value代表前台頁面/xiaozhu?ip=1裡ip的值傳進方法

required代表可以沒有ip=1

defaultvalue代表如果沒有會預設取110

SpringBoot整合Redis 學習筆記

修改服務埠號,修改資料庫url位址值 說明 修改配置路徑的檔案 image.properties檔案.properties的作用就是封裝key value 業務資料 模擬伺服器位址值 這裡注意,在父工程pom檔案中引入 spring整合redis redis.clients groupid jedi...

spring boot 入門學習

1 spring boot使編碼變簡單 2 spring boot使配置變簡單 3 spring boot使部署變簡單 4 spring boot使監控變簡單 5 spring boot的不足 spring boot簡化建立新應用 spring boot 內嵌了tomcat spring boot ...

SpringBoot入門學習 1

springboot可以更快的開發spring應用,自動配置依賴,不用擔心框架的相容性,springboot可以快速構建乙個微服務單元,是整個spring技術棧的整合,j2ee開發的一站式解決方案 templates 模板檔案 freemarker,thymeleaf,預設不支援jsp spring...