pm依赖
spring-boot-starter:Spring Boot核心Starter,包含自动配置、日志、yaml配置文件的支持spring-boot-starter-amqb:使用spring-rabbit来支持AMQPspring-boot-starter-web:支持全栈web开发,里面包括了Tomcat和Spring-webmvc。spring-boot-starter-data-jpa:对JPA的支持,包含spring-data-jpa、spring-orm和Hibernatespring-boot-starter-thymeleaf:对Thymeleaf模版引擎的支持,包含于Spring整合的配置spring-boot-starter-ws: 提供对Spring Web Services的支持spring-boot-starter-cloud-connectors:对云平台(Cloud Foundry、Heroku)提供的服务简化连接方式spring-boot-starter-test:提供对常用测试框架的支持,包括JUnit,Hamcrest以及Mockito等。spring-boot-starter-actuator:支持产品环境下的一些功能,比如管理应用、指标度量及监控等。spring-boot-starter-jetty:支持jetty容器。spring-boot-starter-log4j:引入默认的log框架(logback)
开发标准web项目,pom文件配置如下
<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> <!-- spring boot基本环境 --> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.3.1.RELEASE</version> </parent> <groupId>spring.boot</groupId> <artifactId>cloud-simple-helloword</artifactId> <version>0.0.1</version> <packaging>jar</packaging> <name>cloud-simple-helloword</name> <dependencies> <!--web应用基本环境配置 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build></project>
编写你的用户请求入口类,即我们写的controller类
需要加上注解生效 @RestController
启动执行器注解@SpringBootApplication 集成了@Configuration、@EnableAutoConfiguration、@EnableWebMvc、@ComponentScan四个注解的功能。
spring cloud pom依赖
spring-cloud-starter-parent 具备spring-boot-starter-parent同样功能并附加Spring Cloud的依赖 spring-cloud-starter-config 默认的配置服务依赖,快速自动引入服务的方式,端口8888 spring-cloud-config-server/client 用户自定义配置服务的服务端/客户端依赖 spring-cloud-starter-eureka-server 服务发现的Eureka Server依赖 spring-cloud-starter-eureka 服务发现的Eureka客户端依赖 spring-cloud-starter-hystrix/zuul/feign/ribbon 断路器(Hystrix),智能路有(Zuul),客户端负载均衡(Ribbon)的依赖 angular-ui-router 页面分发路由依赖
转载于:https://www.cnblogs.com/yyymdl/p/6814630.html
相关资源:JAVA上百实例源码以及开源项目