我在这里阅读了很多关于这种问题的内容,但似乎我的代码很好但是autowire不能正常工作:
Error creating bean with name 'optionController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private service.InteractionBanque controllers.OptionController.interactionBanque; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [service.InteractionBanque] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
Run Code Online (Sandbox Code Playgroud)
这是我的控制器的代码:
package controllers;
package controllers;
import javax.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import model.Banque;
import model.Client;
import service.InteractionBanque;
import serviceimpl.InteractionBanqueImpl;
@Controller …Run Code Online (Sandbox Code Playgroud) 我现在面临一个问题,我现在正在实习,我必须修改一个给定的程序.我有一些滞后问题,我终于找到了问题:日志编写器......
程序运行的越多,它就越慢,实际上就越慢.我发现这是因为日志文件的编写器,这里是代码:
using (StreamWriter swLog = new StreamWriter(GenerateDaylog(_logPath), true))
{
String sLog = "";
sLog += DateTime.Now.ToShortDateString();
sLog += " ";
sLog += DateTime.Now.ToLongTimeString();
sLog += "\t";
sLog += new StackFrame(1).GetMethod().DeclaringType.Name;
sLog += "\t";
sLog += new StackFrame(1).GetMethod().Name;
sLog += "\t";
sLog += msg;
Trace.Listeners.Add(new TextWriterTraceListener(swLog));
Trace.WriteLine(sLog);
}
Run Code Online (Sandbox Code Playgroud)
现在,日志文件大约为100 - 500 ko,每天都会创建一个新日志文件,并在其名称中包含日期.
我想这个写行者有问题,但我无法弄清楚它是什么.