0
我的主要代码自动装配在构造的情况下,与插座
public static void main(String[] args) {
System.out.println("Hello World!");
ApplicationContext applicationContext = new ClassPathXmlApplicationContext(
"DataSource.xml");
App app = applicationContext.getBean(App.class);
app.start();
}
而且我做起方法
public void start() {
try {
ServerSocket mobCom = new ServerSocket(9846);
ExecutorService executorService = Executors.newCachedThreadPool();
while (true) {
Socket socket = mobCom.accept();
PortService portService = new PortService(socket);
executorService.submit(portService);
}
} catch (IOException e) {
e.printStackTrace();
}
}
参数,但我想从春天创建PortService对象,而不是直接,因为它有db通信类。我该怎么做。