这是我的第一个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