spring boot starter工程啟動就關閉的問題


配置了maven中的mirror后,maven用起來就像是飛一般的感覺。

<mirror>
<id>nexus-aliyun</id>
<mirrorOf>*</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>

近期在入手Spring框架,經過十幾年沉淀的東西,確實博大精深。

作為Starter(老菜鳥)翻了幾本過時的pdf后,終於痛下決心從http://spring.io/guides開始一點一點的啃。

第一個hello world webserivce工程,就遇到了一個神奇的問題

Spring shutdown on start up!!!具體的錯誤,居然不是用ERROR標識,而是用info

INFO 4068 --- [lication Thread] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext

INFO 4068 --- [lication Thread] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown

這坑爹的貨。但是按着教程操作的東西都會出錯。。W.H.Y?

原來使用Spring Tool Suite(STS)向導(Import Spring Getting Started Content)新建的Rest 工程中自帶的pom.xml文件內容與http://spring.io/guides中的內容不符。

重點是少了如下依賴:

<dependency>

            <groupId>org.springframework.boot</groupId>

            <artifactId>spring-boot-starter-web</artifactId>

        </dependency>

        <dependency>

            <groupId>org.springframework.boot</groupId>

            <artifactId>spring-boot-starter-test</artifactId>

            <scope>test</scope>

        </dependency>

        <dependency>

            <groupId>com.jayway.jsonpath</groupId>

            <artifactId>json-path</artifactId>

            <scope>test</scope>

 

        </dependency>

補上,就不會一啟動就自動關閉Spring了。

-----------------------------------------------------------------------------------

就跟小時候做語文課后習題一樣——答案就在文章中。

BTW,今天看的是

Building a RESTful Web Service

holy血,一把年紀了還在hello world,8特,I DO LIKE IT.

Spring shutdown on start up

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM