spring

结构

controller
domain 域对象
service 服务层
entity 实体类

注解

@RestController (spring的4.0版本) 相当于 @Controller和@RequestBody的组合

@CorssOrigin 跨域请求

url参数传递

当使用@RequestBody时,传递的参数会被sping解析为json格式

  • @PathVariable 传递url中加入的参数 eg. zhihu.com/1
  • @RequestParm 传递?后的附加参数 eg. zhihu.com?id=xxx&pass=xx
    当URL指向的是某一具体业务资源(或者资源列表),例如博客、用户时,使用@PathVariable
    当URL需要对资源或者资源列表进行过滤、筛选时,用@RequestParam

spring 的所有模块

groupId artifactId 描述
org.springframework spring-aop 基于代理的AOP
org.springframework spring-aspects 基于切面的AspectJ
org.springframework spring-beans bean支持,包括Groovy
org.springframework spring-context 运行时上下文,包括调度和远程调用抽象
org.springframework spring-context-support 包含用于集成第三方库到Spring上下文的类
org.springframework spring-core 核心库,被许多其它模块使用
org.springframework spring-expression Spring表达式语言
org.springframework spring-instrument JVM引导的检测代理
org.springframework spring-instrument-tomcat tomcat的检测代理
org.springframework spring-jdbc JDBC支持包,包括对数据源设置和JDBC访问支持
org.springframework spring-jms JMS支持包,包括发送和接收JMS消息的帮助类
org.springframework spring-messaging 消息处理的架构和协议
org.springframework spring-orm 对象关系映射,包括对JPA和Hibernate支持
org.springframework spring-oxm 对象XML映射
org.springframework spring-test 单元测试和集成测试组件
org.springframework spring-tx 事务基础,包括对DAO的支持及JCA的集成
org.springframework spring-web web支持包,包括客户端及web远程调用
org.springframework spring-webmvc REST web服务及web应用的MVC实现
org.springframework spring-webmvc-portlet 用于Portlet环境的MVC实现
org.springframework spring-websocket WebSocket和SockJS实现,包括对STOMP的支持

你可能感兴趣的:(spring)