亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

了解spring @Configuration類

了解spring @Configuration類

楊__羊羊 2019-12-07 15:43:06
在理解“ Spring @Autowired用法”這個問題之后,我想為彈簧接線的另一個選項(@Configuration類)創建一個完整的知識庫。假設我有一個看起來像這樣的spring XML文件:<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">  <import resource="another-application-context.xml"/>  <bean id="someBean" class="stack.overflow.spring.configuration.SomeClassImpl">    <constructor-arg value="${some.interesting.property}" />  </bean>  <bean id="anotherBean" class="stack.overflow.spring.configuration.AnotherClassImpl">    <constructor-arg ref="someBean"/>    <constructor-arg ref="beanFromSomewhereElse"/>  </bean></beans>我該如何使用@Configuration呢?它對代碼本身有影響嗎?
查看完整描述

3 回答

?
牛魔王的故事

TA貢獻1830條經驗 獲得超3個贊

這是一個很好的論據,我已經聽過幾次了。而且我嘗試進行一些統計研究,在其中我找不到在jars / wars之外使用XML的任何應用程序或系統。它的實際含義是您需要解壓縮jar并更改XML(我找不到找到它的人)或重建您的jar(這是我與之交談的所有人到目前為止所做的事情) 。因此,底線-盡管可能是一個相當大的論點,但在現實生活中通常并不重要。 

查看完整回答
反對 回復 2019-12-07
  • 3 回答
  • 0 關注
  • 555 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號