Hibernate – cfg.xml 在资源中未找到

huangapple go评论77阅读模式
英文:

Hibernate - cfg.xml Not Found in Resources

问题

Common issue but all the threads about this never managed to solve my issue.

Here's my very simple test setup:

public class HibernateSandboxApplication {

    public static void main(String[] args) {
        new Configuration().configure();
    }
}

Project structure:

Hibernate – cfg.xml 在资源中未找到

Why can't configure() find my cfg.xml in the resources folder?

英文:

Edit: Removed the spring snippets

Common issue but all the threads about this never managed to solve my issue.

Here's my very simple test setup:

public class HibernateSandboxApplication {

    public static void main(String[] args) {
	    new Configuration().configure();
    }
}

Project structure:

Hibernate – cfg.xml 在资源中未找到

Why can't configure() find my cfg.xml in the resources folder?

答案1

得分: 0

你需要在applicationContext.xml中声明它。在这里查看:https://stackoverflow.com/questions/471799/spring-and-hibernate-cfg-xml

英文:

You need to declare it in the applicationContext.xml. Have a look here: https://stackoverflow.com/questions/471799/spring-and-hibernate-cfg-xml

huangapple
  • 本文由 发表于 2020年8月6日 04:38:16
  • 转载请务必保留本文链接:https://go.coder-hub.com/63273168.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定