spring cloud is a rapid development framework in spring. This example uses spring+maven to configure a simple spring development example.
1. First install the java and maven environments.
①, install java, do not do too much description. I installed it on the D drive. As shown below
②, configure the JDK of java
3. Execute the cmd command, check the java installation, enter java -version (check the installation version), both java and javac are available, as shown below
2. First install the maven environment.
Download the maven installation package online
decompress
Manual configuration of configuration files
Make environment configuration
Test whether the installation is successful
In the above cases, the configuration is successful.
3. Configure maven in myeclipse
4. Myeclipse configuration is complete, let's start to create a simple instance
Default pom file
Import common packages
<!-- Inherit defaults from Spring Boot --> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.4.3.RELEASE</version> </parent> <!-- Additional lines to be added here... --> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</optional> </dependency> <dependency> <groupId>org.webjars</groupId> <artifactId>jquery</artifactId> <version>2.2.4</version> </dependency> <dependency> <groupId>org.webjars</groupId> <artifactId>bootstrap</artifactId> <version>3.3.7</version> </dependency> </dependencies> <!-- Package as an executable jar --> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build>
Create an instance of java
1 import org.springframework.boot.*; 2 import org.springframework.boot.autoconfigure.*; 3 import org.springframework.stereotype.*; 4 import org.springframework.web.bind.annotation.*; 5 6 @RestController 7 @EnableAutoConfiguration 8 public class Example { 9 10 @RequestMapping("/") 11 String home() { 12 return "Hello World!"; // Copyright: w w w . y i I b A i.c O m 13 } 14 15 public static void main(String[] args) throws Exception { 16 SpringApplication.run(Example.class, args); 17 } 18 19 }
Just click run
represents success
Note: The java version used must be similar to maven (java 1.5 and above), and it is best to install and configure the same