• Spring MVC


    1. spring mvc如果return是ok客户端就一直转呀转的,都是拿不到response,如果换成其实字符串就可以,奇怪。

        @RequestMapping(value = "test", produces="application/json;charset=utf-8") 
        @ResponseBody
        public String test(){
            return "ok";
        }

    2. @Resource和@Autowired的区别。

    比如:

        @Autowired
        private RecommendCommonService recommendService;

    这个会去查找RecommendCommonService类型的bean,找不到就报UnsatisfiedDependencyException和NoUniqueBeanDefinitionException错误。

    如果是

        @Resource
        private RecommendCommonService recommendService;

    就会先去查找有没有id为recommendService的bean,如果没有,就去找有没有类型为RecommendCommonService 的bean.

    2017-10-10

    对Strping的注入规则有认识上的错误。我今天在一个@Service的类SystemSettingsService的构造函数里,想调用它的一个成员接口

        @Autowired
        private CommonService commonService;

    发现,在构造函数调用的时候commonService是空的,但是,把SystemSettingsService放到控制器,或者别的Service类里面作为成员接口的时候,再调用它的一个方法,发现这时候,

    commonService不为空。

    2018-03-19

    如果路径定义(请求接口)重了,会报这个错。

    2018-03-19 14:56:14,168 WARN  support.XmlWebApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: 
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name
    'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping': Invocation of init method failed; nested exception is
    java.lang.IllegalStateException: Ambiguous mapping. Cannot map 'gameHallController' method public void com.feikantec.game.suit_tiles.controller.GameHallController.desk(javax.servlet.http.HttpServletResponse,java.lang.Integer,java.lang.Integer) to {[/hallStat]}: There is already 'debugController' bean method public void com.feikantec.game.suit_tiles.controller.DebugController.hallStat(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) mapped.
  • 相关阅读:
    「专题总结」后缀自动机
    「专题总结」回文自动机
    「专题总结」后缀数组
    2.11毕设进度
    2.10毕设进度
    2.09毕设进度
    2.08毕设进度
    2.07毕设进度
    2.06毕设进度
    2.05毕设进度
  • 原文地址:https://www.cnblogs.com/angelshelter/p/6600998.html
Copyright © 2020-2023  润新知