spring-boot出乎意料的好用,本文給大家展示生産實踐中怎麼用spring-boot。
工程結構代碼 收藏代碼
xml代碼 收藏代碼
application.properties
properties代碼 收藏代碼
application-test.properties
application-bean.xml spring-boot追求無xml配置,但仍可以加載xml配置
index.html
html代碼 收藏代碼
java代碼 收藏代碼
注意,application類所在包及子包下的所有類預設均在componentscan非為内。
三種啟動方式:
application.main()
mvn spring-boot:run
java -jar whatsmars-spring-boot.jar