小编Saj*_*had的帖子

IntelliJ中的CLI-Spring Shell

我正在使用IntelliJ中的CLI Spring shell代码.我运行它并给出一些参数.但是当我输入insert并按回车键时,控制台不接受它,看起来好像什么也没发生!

我的代码:

@Component
public class HelloWorldCommands implements CommandMarker {

    @CliCommand(value = "insert", help = "insert data to ParsEMS DB")
    public void insert() {
        try {
            Class.forName("org.postgresql.Driver");
            Connection con = DriverManager.getConnection("jdbc:postgresql://localhost:5432/ParsEMS", "xxxxxx", "xxxxxxx");
            Statement st = con.createStatement();
            st.executeUpdate("INSERT INTO node (name, destination) VALUES ('b', 200)");
        } catch (Exception e) {
            e.printStackTrace();
        }
        System.out.println("insert to ParsEMS DB");
    }
}



public class Main {
    public static void main(String[] args) throws Exception {
        Bootstrap.main(args);
    }
}   
Run Code Online (Sandbox Code Playgroud)

我跑的时候会看到以下结果;

1.1.0.RELEASE

欢迎来到Spring Shell.如需帮助,请按或键入"提示",然后按ENTER键.

弹簧壳>

java command-line-interface spring-shell

9
推荐指数
1
解决办法
3176
查看次数

如何清理或清理在IntelliJ IDEA中构建我的Maven项目?

我在Java项目中使用Apache Maven.在NetBeans中有构建和清理构建图标,但在IntellIJ IDEA中没有.如何清理或清理构建我的项目?

netbeans build intellij-idea netbeans-8 intellij-14

6
推荐指数
4
解决办法
2万
查看次数