1. 程式人生 > >[spring-boot]sonar這坑貨……

[spring-boot]sonar這坑貨……

Q:spring boot啟動後自動關閉,what fuck

spring boot啟動日誌:

D:\project\spring-boot-guide>mvn spring-boot:run
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building spring-boot Maven Webapp 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> spring-boot-maven-plugin:1.5.4.RELEASE:run (default-cli) > test-compile @ spring-boot >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ spring-boot ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ spring-boot ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ spring-boot ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory D:\project\spring-boot-guide\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ spring-boot ---
[INFO] No sources to compile
[INFO]
[INFO] <<< spring-boot-maven-plugin:1.5.4.RELEASE:run (default-cli) < test-compile @ spring-boot <<<
[INFO]
[INFO] --- spring-boot-maven-plugin:1.5.4.RELEASE:run (default-cli) @ spring-boot ---


  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v1.5.4.RELEASE)


2017-06-09 15:07:29.320  INFO 2076 --- [           main] c.m.s.guide.controller.GuideController   : Starting GuideController on PC-JIAYI with PID 2076 (D:\project\spring-boot-guide\target\classes started by jiayi in D:\project\spring-boot-guide)
2017-06-09 15:07:29.336  INFO 2076 --- [           main] c.m.s.guide.controller.GuideController   : No active profile set, falling back to default profiles: default
2017-06-09 15:07:29.375  INFO 2076 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot

[email protected]6fc0559b: startup date [Fri Jun 09 15:07:29 CST 2017]; root of context hierarchy
2017-06-09 15:07:30.474  INFO 2076 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2017-06-09 15:07:30.484  INFO 2076 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2017-06-09 15:07:30.486  INFO 2076 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.15
2017-06-09 15:07:30.568  INFO 2076 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2017-06-09 15:07:30.568  INFO 2076 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 1196 ms
2017-06-09 15:07:30.682  INFO 2076 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Mapping servlet: 'dispatcherServlet' to [/]
2017-06-09 15:07:30.686  INFO 2076 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]
2017-06-09 15:07:30.687  INFO 2076 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2017-06-09 15:07:30.687  INFO 2076 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2017-06-09 15:07:30.687  INFO 2076 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*]
2017-06-09 15:07:30.952  INFO 2076 --- [           main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot
[email protected]
6fc0559b: startup date [Fri Jun 09 15:07:29 CST 2017]; root of context hierarchy
2017-06-09 15:07:31.011  INFO 2076 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/],methods=[GET]}" onto public java.lang.String club.michaeljy.springboot.guide.controller.GuideController.home()
2017-06-09 15:07:31.015  INFO 2076 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servle
t.http.HttpServletRequest)
2017-06-09 15:07:31.016  INFO 2076 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletReq
uest,javax.servlet.http.HttpServletResponse)
2017-06-09 15:07:31.047  INFO 2076 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-06-09 15:07:31.048  INFO 2076 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-06-09 15:07:31.085  INFO 2076 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-06-09 15:07:31.189  INFO 2076 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2017-06-09 15:07:31.244  INFO 2076 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
2017-06-09 15:07:31.249  INFO 2076 --- [           main] c.m.s.guide.controller.GuideController   : Started GuideController in 2.294 seconds (JVM running for 4.799)
2017-06-09 15:07:31.250  INFO 2076 --- [           main] ationConfigEmbeddedWebApplicationContext : Closing org.springframework.boot
[email protected]
6fc0559b: startup date [Fri Jun 09 15:07:29 CST 2017]; root of context hierarchy
2017-06-09 15:07:31.251  INFO 2076 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Unregistering JMX-exposed beans on shutdown

A:一個很簡單的問題,搞得自己很惆悵啊!後來發現是sonar指引我犯錯的!


如上所示,因為idea整合sonarLint的原因,SpringApplication.run這一行程式碼給我報紅了,因為沒有關閉流,我習慣性地安照sonar指引把流關了。然後啟動專案,發現始終訪問不到埠號,後來發現是sonar坑了我,自己把流關了還想訪問tomcat?……

相關推薦

[spring-boot]sonar……

Q:spring boot啟動後自動關閉,what fuck spring boot啟動日誌: D:\project\spring-boot-guide>mvn spring-boot:run [INFO] Scanning for projects... [INFO

mvn spring-boot:repackage神“'spring.datasource.url' is not specified and no embedded datasource...”

問題: 一開始以為是`spring.datasource.url`配置有問題,後來發現Intellij idea下能執行,但是打成jar包就不能執行,於是反應過來,應該是application.properties等配置檔案,沒有被打進包裡面去。解壓jar包,果然沒有在classes中找

spring boot jpa(踩)

 1資料庫帶兩個引數,一個時區,一個utf-8 spring: datasource: url: jdbc:mysql://127.0.0.1:3306/test?serverTimezone=GMT%2B8&characterEncoding=UTF-8

Spring boot 初步踩記(一)

初步使用spring boot + mybatis 組合,然而在eclipse 內執行 妥妥的 一點的問題都沒有。打包成jar 和war ,執行時,報錯: Field XXXXin XXXX.DemoApplication required a bean of type

spring boot 初步踩(二)—— 打包載入本地jar

打包時載入本地jar,度娘提供了幾種方式,下邊是我遇到的幾種方式: 1、打包jar 有兩種方式 1) org.springframework.boot spring-boot-maven-plug

Spring boot 初步踩(三)——Thymeleaf javaScript 聯動 數值變化

之前網上搜索 Thymeleaf 標籤 可以直接在js 裡面 獲取 action返回的值,一直在用,今天突然出現了一個奇葩問題,一個時間戳字串,java後臺列印是20180917161154369 通過js 再傳回去就成了2018091716115438了

Spring Boot 2.0幹系列:(一)Spring Boot1.5X升級到2.0指南

大量 gist 博客 指南 gem follow ref contex str 前言Spring Boot已經發布2.0有滿久了,多了很多新特性,一些坑也慢慢被填上,最近有空,就把本博客中Spring Boot幹貨系列對應的源碼從1.5X升級到Spring Boot 2.0

mvn spring-boot:repackage神“'spring.datasource.url' is not specified and no embedded datasource...”

問題: 一開始以為是`spring.datasource.url`配置有問題,後來發現Intellij idea下能執行,但是打成jar包就不能執行,於是反應過來,應該是application.properties等配置檔案,沒有被打進包裡面去。解壓jar包,果

【 專欄 】- 詳解 Spring Boot 遇到的

詳解 Spring Boot 遇到的坑 Spring Boot 是一個強大且使用相對簡單的網站應用框架,但是對於不熟悉網站搭建的初學者,這也是難以接受的。通過第一次一步一步的邁過每一個坑後,會發現在以後再使用這個框架是如此簡單。這

Spring Boot Admin排指南

Spring Boot Admin 1.x其簡陋的頁面讓人不忍直視,但更新到2.x系列後,像脫胎換骨一般好用 這篇部落格記錄我

初學spring boot踩過的

9.png field ted require order false test boot mysql- 一、搭建spring boot環境   maven工程       pom文件內容 <project xmlns="http://maven

Spring Boot系列:(二)配置文件解析

set test profile ava java prefix 標註 了解 pre Spring Boot:配置文件解析 前言 上一篇介紹了Spring Boot的入門,知道了Spring Boot使用“習慣優於配置”(項目中存在大量的配置,此外

spring boot整合mybatis深之c3p0的詳細配置

text context ati reat source ast type fig oot 項目地址:https://gitee.com/zhangjunqing/spring-boot/tree/master/springboot-mybatis-notice 本人在c3

spring boot框架學習8-【幹spring boot的web開發(4)-自定義攔截器處理權限

凱哥spring boot spring boot框架 本章節主要內容:通過前面的學習,我們了解並快速完成了spring boot第一個應用。spring boot企業級框架,那麽spring boot怎麽讀取靜態資源?如js文件夾,css文件以及png/jpg圖片呢?怎麽自定義消息轉換器呢?怎麽自定

Spring Boot 開發系列一 開發踩

strong contex configure post crud操作 如何 result png exce 這是學習spring boot 的第二周,公司號稱這玩意是啥都不會的新手就可以填空開發,於是決定上手一把,怎麽說我也是搞了快七八年的.NET和.NETcore,沒想

spring boot 跳轉頁面和熱加載的

star end 模版 pre devtools work ram 生產環境 false 跳轉頁面需要加上模版依賴:<!--thymeleaf--><dependency> <groupId>org.springframework.b

【轉】Spring Boot系列:(三)啟動原理解析

無法 time exp 記得 started 打印 ping 正文 exclude 前言 前面幾章我們見識了SpringBoot為我們做的自動配置,確實方便快捷,但是對於新手來說,如果不大懂SpringBoot內部啟動原理,以後難免會吃虧。所以這次博主就跟你們一起一步步揭開

spring boot集成模板引擎Thymeleaf中遇到的

固定 con sources index pac 調用 return div template 首先,所有html文件都要放在固定路徑下才能被正確讀取到,/main/java/resources/templates這個路徑下,而且html所有的標簽必須閉合,否則啟動報錯 今

給大家聊一聊雲收藏從 Spring Boot 1.0 升級到 2.0 所踩的

springboot 雲收藏 先給大家曬一下雲收藏的幾個數據,作為一個 Spring Boot 的開源項目(https://github.com/cloudfavorites/favorites-web)目前在 Github 上面已經有1600多個 Star,如果按照 SpringBoot 標簽進行篩

Java,開始Spring boot 的後端開發之路

也有 得來 中間 調用 代碼 行記錄 廣泛 隨手記 domain 換了工作,從遊戲行業的大坑中走了出來,走向互聯網的大世界。新的公司是電商方向,電商行業萬變不離其宗,java,spring是最廣泛的技術。當然也有過一些特立獨行的,也做得很大,不過現在都基本切換到了這個方向。