
spring
song_suo
程序员
展开
-
spring 异步方法
用注解@Async标注在xsd约束中,要有xmlns:task="http://www.springframework.org/schema/task" http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.0.xsd在spring的xml文件中,要有<原创 2017-05-11 20:42:52 · 629 阅读 · 0 评论 -
spring boot 中配置文件的读取和多环境配置
配置文件中如果配置项很多的话,最好是写一个或者多个配置对象来读取配置。建议使用yml格式来写配置文件。这种格式更加面向对象一点。比如person: name: zhangsan age: 45server: port: 8888 context-path: /xxxcupSize: D注意,冒号后面有个空格,这个是yml格式的要求。@Component("person") @Conf原创 2017-05-20 22:16:26 · 1060 阅读 · 0 评论 -
spring boot 中@RestController 注解
spring boot 可以认为是spring mvc 的升级版。 在spring mvc 中,用的是@Controller注解@RestController注解相当于 @Controller与@ResponseBody这两个注解的作用。现在的web开发,大多数都是前后端分离的。所以用@RestController注解会更多。基本上不会用到ModelAndView了。原创 2017-05-20 22:41:05 · 4423 阅读 · 0 评论