ssm
老王的orange
同自己和这个世界和解
展开
-
Spring注解@Component、@Repository、@Service、@Controller区别
Spring注解@Component、@Repository、@Service、@Controller区别spring 2.5中除了提供 @Component注释外,还定义了几个拥有特殊语义的注释,它们分别是:@Repository、@Service和 @Controller。在目前的 Spring版本中,这 3 个注释和 @Component 是等效的,但是从注释类的命名转载 2017-03-22 11:14:41 · 958 阅读 · 0 评论 -
spring boot 整合redis
1.新建Spring Boot项目添加spring-boot-starter-data-redis依赖<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId>...转载 2018-03-20 14:39:26 · 115 阅读 · 0 评论 -
解决Spring @Autowired注解在非Controller中注入为null的问题
一、序言今天在写一个非Controller类,里面用了@Autowired注入了@Autowiredprivate ObjectMapper objectMapper;时,在调用objectMapper的readValue()方法一直报 java.lang.nullpointerexception 异常,打断点才发现注入的objectMapper一直为空。二、解决办法通过@...原创 2018-09-27 10:42:09 · 2757 阅读 · 0 评论