【发布时间】:2016-10-27 00:17:39
【问题描述】:
我在tutorial 之后做了一个简单的弹簧应用程序。 运行该应用程序不会在控制台中出现任何错误。
问题:但不幸的是,控制台中的程序没有打印任何内容。 我也无法调试,因为 Eclipse 不会在断点处停止。
注意:我还找到了一个关于 Eclipse 控制台的post,但这些解决方案似乎并不适合我。我认为这是我项目中的一个问题。
问题:是否必须打开特殊视角才能在控制台中看到prinln输出?
主类:
public class SpringDataDemo {
public static void main(String[] args) {
try {
ApplicationContext context = new ClassPathXmlApplicationContext("resources\\spring-configuration.xml");
// Fetch the DAO from Spring Bean Factory
EmployeeDao employeeDao = (EmployeeDao) context.getBean("EmployeeDaoImpl");
Employee employee = new Employee("Employee123");
// employee.setEmployeeId("1");
// Save an employee Object using the configured Data source
employeeDao.save(employee);
System.out.println("Employee Saved with EmployeeId " + employee.getEmployeeId());
// find an object using Primary Key
Employee emp = employeeDao.findByPrimaryKey(employee.getEmployeeId());
System.out.println(emp);
// Close the ApplicationContext
((ConfigurableApplicationContext) context).close();
} catch (BeansException | SQLException e) {
e.printStackTrace();
}
}
}
【问题讨论】:
标签: java eclipse spring spring-data