Service层经常被调用,那么如何正确调用Service层并优化性能。
如下调用
1.在Controller中
XxService XxService = new XxService();
2.在Service中声明
Public static XxService me = new XxService();
在Controller中使用
XxService.me
3.....有没有更好的方式。在不使用依赖注入的情况下
在controller中
private XxService XxService = new XxService();
直接new一个完事。
不明白为啥你不用注入?