第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定

Could not resolve placeholder 'cupszie' in value "cupsize: ${cupszie},age: ${age}"

報錯如下:

Error creating bean with name 'helloController': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'cupszie' in value "cupsize: ${cupszie},age: ${age}"


代碼如下:

application.yml代碼

server:
?port: 8081
?context-path: /girl
cupsize: B
age: 20
content: "cupsize: ${cupszie},age: ${age}"

HelloController.class代碼

@RestController
public class HelloController {

? ?@Value("${cupsize}")
? ?private String cupsize;

? ?@Value("${age}")
? ?private Integer age;

? ?@Value("${content}")
? ?private String content;

? ?@RequestMapping(value = "/hello",method = RequestMethod.GET)
? ?public String say(){
? ? ? ?return content;
? ?}
}

代碼跟老師的一樣,請教老師這是為什么呢

正在回答

12 回答

server:

? port: 8080

? servlet:

? ? context-path: /girl1

girl:?

? cupSzie: B

? age: 12


我的這個是在同一水平,為啥還是獲取不到

0 回復(fù) 有任何疑惑可以回復(fù)我~
server:
??port:?9876
??context-path:?/flowableDemo
cupSize:?38E
age:?23
name:?顏
context:?"cupSize:?${cupSize}?,?age:?${age}?,?name:?${name}"
girl:
??name:?顏
??age:?23
??cupSize:?38E
??height:?167
??weight:?105

報錯

0 回復(fù) 有任何疑惑可以回復(fù)我~

保持sever同一水平
比如:
sever:
port: 8080
cupSize: B
? ? ? ? ? ? ? ? ? ? ? ? ? ? ??

1 回復(fù) 有任何疑惑可以回復(fù)我~

有毒有毒

0 回復(fù) 有任何疑惑可以回復(fù)我~
xml中:server.port:8080
????????cupSize:B
yml中:?server:
?????????port:?8080
???????cupSize:?B
就OK了??偟囊馑际莄upSize和server是同一級別的。


2 回復(fù) 有任何疑惑可以回復(fù)我~
#1

qq_虛偽詮釋了黑夜繁華_0

...第一個是properties中,寫錯了
2017-12-09 回復(fù) 有任何疑惑可以回復(fù)我~

還真是不能有空格。。。。

0 回復(fù) 有任何疑惑可以回復(fù)我~

改為這樣就可以了content: "cupSize: ${server.cupSize}, age: ${server.age}"

2 回復(fù) 有任何疑惑可以回復(fù)我~

樓主,在配置文件那里是不能留有空格的,明顯的你port下面的

server:
?????????port: 8081
?????????context-path: /girl
????????cupsize: B
????????age:?

屬性是有空格的,所以需要加server.cupSize,要跟server一樣哦,沒有縮進,如下:

server:
?port: 8081
context-path: /girl
cupsize: B
?age:

6 回復(fù) 有任何疑惑可以回復(fù)我~
#1

葉止_風(fēng)系

這你都發(fā)現(xiàn)了,si go yi !
2017-10-30 回復(fù) 有任何疑惑可以回復(fù)我~

我的也是這個問題 只要yml文件格式寫好了在controller中加上server.context就可以了獲取了 樓主可以試試

0 回復(fù) 有任何疑惑可以回復(fù)我~

樓主解決了沒有


0 回復(fù) 有任何疑惑可以回復(fù)我~
首頁上一頁12下一頁尾頁

舉報

0/150
提交
取消
2小時學(xué)會Spring Boot
  • 參與學(xué)習(xí)       151527    人
  • 解答問題       1132    個

Spring Boot入門視頻教程,你將學(xué)會使用Spring Boot快速構(gòu)建應(yīng)用程序

進入課程

Could not resolve placeholder 'cupszie' in value "cupsize: ${cupszie},age: ${age}"

我要回答 關(guān)注問題
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號