IDEA搭建SpringBoot項目

這里記錄下簡單的Springboot項目

1.新建一個project

a1.png

2.選擇spring initializr選項然后下一步,JDK1.8(自行選擇)

image

這里有個問題:有的人在選項里沒有這個選項只有Spring,這是因為你的idea沒有安裝Spring boot插件.

在settings-->plugins-->勾選Spring boot 后面的方框然后重啟idea就可以看到這個選項了.

image
image
image
image

4.打開項目運行

image
image
image

可以看到默認端口是8080

需要更改端口的時候在配置文件'application.properties'里更改server.port參數(shù),默認里面是沒有內(nèi)容的,把它填上就好了

image

這里把pom.xml里的內(nèi)容粘出來方便eclipse的各位粘貼


<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.example</groupId>
    <artifactId>test</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>test</name>
    <description>Demo project for Spring Boot</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.3.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <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>
    </dependencies>

    


</project>


* * *

這里在附帶的寫一些配置信息,方便下次需要時添加,ctrl+f搜索一下自己需要的,沒找到的可以去官網(wǎng)找

*# LOGGING*

logging.config= *# Location of the logging configuration file. For instance `classpath:logback.xml` for Logback*

logging.exception-conversion-word=%wEx *# Conversion word used when logging exceptions.*

logging.file= *# Log file name. For instance `myapp.log`*

logging.level.*= *# Log levels severity mapping. For instance `logging.level.org.springframework=DEBUG`*

logging.path= *# Location of the log file. For instance `/var/log`*

logging.pattern.console= *# Appender pattern for output to the console. Only supported with the default logback setup.*

logging.pattern.file= *# Appender pattern for output to the file. Only supported with the default logback setup.*

logging.pattern.level= *# Appender pattern for log level (default %5p). Only supported with the default logback setup.*

logging.register-shutdown-hook=false *# Register a shutdown hook for the logging system when it is initialized.*

*# AOP*

spring.aop.auto=true *# Add @EnableAspectJAutoProxy.*

spring.aop.proxy-target-class=false *# Whether subclass-based (CGLIB) proxies are to be created (true) as opposed to standard Java interface-based proxies (false).*

*# ----------------------------------------*

*# WEB PROPERTIES*

*# ----------------------------------------*

*# EMBEDDED SERVER CONFIGURATION (*[ServerProperties](https://github.com/spring-projects/spring-boot/tree/v1.5.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java))

server.address= *# Network address to which the server should bind to.*

server.compression.enabled=false *# If response compression is enabled.*

server.compression.excluded-user-agents= *# List of user-agents to exclude from compression.*

server.compression.mime-types= *# Comma-separated list of MIME types that should be compressed. For instance `text/html,text/css,application/json`*

server.compression.min-response-size= *# Minimum response size that is required for compression to be performed. For instance 2048*

server.connection-timeout= *# Time in milliseconds that connectors will wait for another HTTP request before closing the connection. When not set, the connector's container-specific default will be used. Use a value of -1 to indicate no (i.e. infinite) timeout.*

server.context-parameters.*= *# Servlet context init parameters. For instance `server.context-parameters.a=alpha`*

server.context-path= *# Context path of the application.*

server.display-name=application *# Display name of the application.*

server.max-http-header-size=0 *# Maximum size in bytes of the HTTP message header.*

server.error.include-stacktrace=never *# When to include a "stacktrace" attribute.*

server.error.path=/error *# Path of the error controller.*

server.error.whitelabel.enabled=true *# Enable the default error page displayed in browsers in case of a server error.*

server.jetty.acceptors= *# Number of acceptor threads to use.*

server.jetty.max-http-post-size=0 *# Maximum size in bytes of the HTTP post or put content.*

server.jetty.selectors= *# Number of selector threads to use.*

server.jsp-servlet.class-name=org.apache.jasper.servlet.JspServlet *# The class name of the JSP servlet.*

server.jsp-servlet.init-parameters.*= *# Init parameters used to configure the JSP servlet*

server.jsp-servlet.registered=true *# Whether or not the JSP servlet is registered*

server.port=8080 *# Server HTTP port.*

server.server-header= *# Value to use for the Server response header (no header is sent if empty)*

server.servlet-path=/ *# Path of the main dispatcher servlet.*

server.use-forward-headers= *# If X-Forwarded-* headers should be applied to the HttpRequest.*

server.session.cookie.comment= *# Comment for the session cookie.*

server.session.cookie.domain= *# Domain for the session cookie.*

server.session.cookie.http-only= *# "HttpOnly" flag for the session cookie.*

server.session.cookie.max-age= *# Maximum age of the session cookie in seconds.*

server.session.cookie.name= *# Session cookie name.*

server.session.cookie.path= *# Path of the session cookie.*

server.session.cookie.secure= *# "Secure" flag for the session cookie.*

server.session.persistent=false *# Persist session data between restarts.*

server.session.store-dir= *# Directory used to store session data.*

server.session.timeout= *# Session timeout in seconds.*

server.session.tracking-modes= *# Session tracking modes (one or more of the following: "cookie", "url", "ssl").*

server.ssl.ciphers= *# Supported SSL ciphers.*

server.ssl.client-auth= *# Whether client authentication is wanted ("want") or needed ("need"). Requires a trust store.*

server.ssl.enabled= *# Enable SSL support.*

server.ssl.enabled-protocols= *# Enabled SSL protocols.*

server.ssl.key-alias= *# Alias that identifies the key in the key store.*

server.ssl.key-password= *# Password used to access the key in the key store.*

server.ssl.key-store= *# Path to the key store that holds the SSL certificate (typically a jks file).*

server.ssl.key-store-password= *# Password used to access the key store.*

server.ssl.key-store-provider= *# Provider for the key store.*

server.ssl.key-store-type= *# Type of the key store.*

server.ssl.protocol=TLS *# SSL protocol to use.*

server.ssl.trust-store= *# Trust store that holds SSL certificates.*

server.ssl.trust-store-password= *# Password used to access the trust store.*

server.ssl.trust-store-provider= *# Provider for the trust store.*

server.ssl.trust-store-type= *# Type of the trust store.*

server.tomcat.accept-count= *# Maximum queue length for incoming connection requests when all possible request processing threads are in use.*

server.tomcat.accesslog.buffered=true *# Buffer output such that it is only flushed periodically.*

server.tomcat.accesslog.directory=logs *# Directory in which log files are created. Can be relative to the tomcat base dir or absolute.*

server.tomcat.accesslog.enabled=false *# Enable access log.*

server.tomcat.accesslog.pattern=common *# Format pattern for access logs.*

server.tomcat.accesslog.prefix=access_log *# Log file name prefix.*

server.tomcat.accesslog.rename-on-rotate=false *# Defer inclusion of the date stamp in the file name until rotate time.*

server.tomcat.accesslog.request-attributes-enabled=false *# Set request attributes for IP address, Hostname, protocol and port used for the request.*

server.tomcat.accesslog.rotate=true *# Enable access log rotation.*

server.tomcat.accesslog.suffix=.log *# Log file name suffix.*

server.tomcat.additional-tld-skip-patterns= *# Comma-separated list of additional patterns that match jars to ignore for TLD scanning.*

server.tomcat.background-processor-delay=30 *# Delay in seconds between the invocation of backgroundProcess methods.*

server.tomcat.basedir= *# Tomcat base directory. If not specified a temporary directory will be used.*

server.tomcat.internal-proxies=10\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}|\\

        192\\.168\\.\\d{1,3}\\.\\d{1,3}|\\

        169\\.254\\.\\d{1,3}\\.\\d{1,3}|\\

        127\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}|\\

        172\\.1[6-9]{1}\\.\\d{1,3}\\.\\d{1,3}|\\

        172\\.2[0-9]{1}\\.\\d{1,3}\\.\\d{1,3}|\\

        172\\.3[0-1]{1}\\.\\d{1,3}\\.\\d{1,3}*# regular expression matching trusted IP addresses.*

server.tomcat.max-connections= *# Maximum number of connections that the server will accept and process at any given time.*

server.tomcat.max-http-post-size=0 *# Maximum size in bytes of the HTTP post content.*

server.tomcat.max-threads=0 *# Maximum amount of worker threads.*

server.tomcat.min-spare-threads=0 *# Minimum amount of worker threads.*

server.tomcat.port-header=X-Forwarded-Port *# Name of the HTTP header used to override the original port value.*

server.tomcat.protocol-header= *# Header that holds the incoming protocol, usually named "X-Forwarded-Proto".*

server.tomcat.protocol-header-https-value=https *# Value of the protocol header that indicates that the incoming request uses SSL.*

server.tomcat.redirect-context-root= *# Whether requests to the context root should be redirected by appending a / to the path.*

server.tomcat.remote-ip-header= *# Name of the http header from which the remote ip is extracted. For instance `X-FORWARDED-FOR`*

server.tomcat.uri-encoding=UTF-8 *# Character encoding to use to decode the URI.*

server.undertow.accesslog.dir= *# Undertow access log directory.*

server.undertow.accesslog.enabled=false *# Enable access log.*

server.undertow.accesslog.pattern=common *# Format pattern for access logs.*

server.undertow.accesslog.prefix=access_log. *# Log file name prefix.*

server.undertow.accesslog.rotate=true *# Enable access log rotation.*

server.undertow.accesslog.suffix=log *# Log file name suffix.*

server.undertow.buffer-size= *# Size of each buffer in bytes.*

server.undertow.buffers-per-region= *# Number of buffer per region.*

server.undertow.direct-buffers= *# Allocate buffers outside the Java heap.*

server.undertow.io-threads= *# Number of I/O threads to create for the worker.*

server.undertow.max-http-post-size=0 *# Maximum size in bytes of the HTTP post content.*

server.undertow.worker-threads= *# Number of worker threads.*
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末们陆,一起剝皮案震驚了整個濱河市,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌产弹,老刑警劉巖休讳,帶你破解...
    沈念sama閱讀 221,888評論 6 515
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件耸序,死亡現(xiàn)場離奇詭異拟逮,居然都是意外死亡掉伏,警方通過查閱死者的電腦和手機细燎,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 94,677評論 3 399
  • 文/潘曉璐 我一進店門两曼,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人玻驻,你說我怎么就攤上這事悼凑。” “怎么了璧瞬?”我有些...
    開封第一講書人閱讀 168,386評論 0 360
  • 文/不壞的土叔 我叫張陵户辫,是天一觀的道長。 經(jīng)常有香客問我嗤锉,道長渔欢,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 59,726評論 1 297
  • 正文 為了忘掉前任瘟忱,我火速辦了婚禮奥额,結(jié)果婚禮上苫幢,老公的妹妹穿的比我還像新娘。我一直安慰自己垫挨,他們只是感情好韩肝,可當我...
    茶點故事閱讀 68,729評論 6 397
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著九榔,像睡著了一般哀峻。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上哲泊,一...
    開封第一講書人閱讀 52,337評論 1 310
  • 那天剩蟀,我揣著相機與錄音,去河邊找鬼切威。 笑死育特,一個胖子當著我的面吹牛,可吹牛的內(nèi)容都是我干的牢屋。 我是一名探鬼主播且预,決...
    沈念sama閱讀 40,902評論 3 421
  • 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢啊……” “哼烙无!你這毒婦竟也來了锋谐?” 一聲冷哼從身側(cè)響起,我...
    開封第一講書人閱讀 39,807評論 0 276
  • 序言:老撾萬榮一對情侶失蹤截酷,失蹤者是張志新(化名)和其女友劉穎涮拗,沒想到半個月后,有當?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體迂苛,經(jīng)...
    沈念sama閱讀 46,349評論 1 318
  • 正文 獨居荒郊野嶺守林人離奇死亡三热,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 38,439評論 3 340
  • 正文 我和宋清朗相戀三年,在試婚紗的時候發(fā)現(xiàn)自己被綠了三幻。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片就漾。...
    茶點故事閱讀 40,567評論 1 352
  • 序言:一個原本活蹦亂跳的男人離奇死亡,死狀恐怖念搬,靈堂內(nèi)的尸體忽然破棺而出抑堡,到底是詐尸還是另有隱情,我是刑警寧澤朗徊,帶...
    沈念sama閱讀 36,242評論 5 350
  • 正文 年R本政府宣布首妖,位于F島的核電站,受9級特大地震影響爷恳,放射性物質(zhì)發(fā)生泄漏有缆。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點故事閱讀 41,933評論 3 334
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望棚壁。 院中可真熱鬧杯矩,春花似錦、人聲如沸灌曙。這莊子的主人今日做“春日...
    開封第一講書人閱讀 32,420評論 0 24
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽在刺。三九已至,卻和暖如春头镊,著一層夾襖步出監(jiān)牢的瞬間蚣驼,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 33,531評論 1 272
  • 我被黑心中介騙來泰國打工相艇, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留颖杏,地道東北人。 一個月前我還...
    沈念sama閱讀 48,995評論 3 377
  • 正文 我出身青樓坛芽,卻偏偏與公主長得像留储,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個殘疾皇子咙轩,可洞房花燭夜當晚...
    茶點故事閱讀 45,585評論 2 359