javascript
bean覆盖 springboot_SpringBoot中如何进行Bean配置
在控制器MessageController中注入IMessageService:
package com.gwolf.controller;
import ch.qos.logback.core.net.SyslogOutputStream;
import com.gwolf.service.IMessageService;
import com.gwolf.util.controller.AbstractBaseController;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@RestController
public class MessageController extends AbstractBaseController{
@Resource
private IMessageService messageService;
@RequestMapping(value="/",
method = RequestMethod.GET)
public String idnex() {
return this.messageService.info();
}
@RequestMapping(value="/echo",
method = RequestMethod.GET)
public String echo(String mid) {
System.out.println("訪問:" + super.getMessage("member.add.action"));
return super.getMessage("welcome.msg",mid);
}
}
創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎總結
以上是生活随笔為你收集整理的bean覆盖 springboot_SpringBoot中如何进行Bean配置的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 微服务基本环境的搭建
- 下一篇: 利用反射对dao层进行重写