简体   繁体   中英

console println in eclipse not printed

I have made a simple spring application followin a tutorial . Running the application gives me no errors in the console.

Problem: But unfortunately I do not get any prints by the program in the console. I am also not able to debug because Eclipse does not stop at the break point.

Note: I have also found a post about the eclipse console but the solutions do not really seem to work for me. I think it is a problem in my project.

Question: Do I have to open a special perspective to see the prinln output in the console?

Main Class:

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();
        }
    }
}

I got the Eclipse console broken once in a while too. You might have multiple threads running the same instance, just looking at the wrong console tab. Anyway easiest fix would be to completely restart your system.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM