這是我的第一個Spring應用程序。我正嘗試在瀏覽器中顯示Hello,World。我遵循以下步驟,但是我的依賴關係有些問題。我使用的IntelliJ 1.2017Intellij上的Spring Hello World Web App
- 安裝拉鍊從https://spring.io/guides/gs/maven/#initial
- 複製
initial
目錄到我的文件系統
在的IntelliJ:
- 導入項目
- 選擇../initial /pom.xml
- Next - >選擇
org.springframework:gs-maven:0.1.0
- > jdk 1.8 - >完成 - 運行:一切工作正常到這裏。
現在我想要顯示你好,世界!在瀏覽器中,在這裏follwoing步驟:http://projects.spring.io/spring-boot/
- 添加的類
SampleController
- 修改pom.xml的是如下:
<modelVersion>4.0.0</modelVersion> <groupId>org.springframework</groupId> <artifactId>gs-maven</artifactId> <packaging>jar</packaging> <version>0.1.0</version> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.2.RELEASE</version> </parent> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <version>2.1</version> <executions> <execution> <phase>package</phase> <goals> <goal>shade</goal> </goals> <configuration> <transformers> <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> <mainClass>hello.HelloWorld</mainClass> </transformer> </transformers> </configuration> </execution> </executions> </plugin> </plugins> </build>
- 右擊項目,並添加框架支持 - >添加彈簧
- 獲得:無法解析symbole啓動,並且:無法解析symbole EnableAutoConfiguration
我不會對行家太多的經驗,和依賴性,因此我試圖按照指示從字面上。我的步驟有什麼錯誤?
我不認爲依賴加載/檢索,SA嘗試運行「命令mvn乾淨安裝」或使用的IntelliJ Maven插件刷新depenedencies 。 –
@MohsanShakir如何使用intellij maven插件來刷新依賴關係? – Hawk
請參閱http://stackoverflow.com/a/42427510/104891。 – CrazyCoder