Home > Back-end >  The Java project with the idea after packaged into a jar file on the computer to run the jar program
The Java project with the idea after packaged into a jar file on the computer to run the jar program

Time:11-26

Can run normally in the idea, not using maven, Java projects involving spring and mybatis
The main method is as follows :

The project is as follows:


The Spring configuration is as follows:

An error log is as follows:
The Exception in the thread "main" org. Springframework. Beans. Factory. NoSuchBeanDefinitionException: No bean named 'afterSaleMapper' is defined in
The at org. Springframework. Beans. Factory. Support. DefaultListableBeanFactory. GetBeanDefinition (DefaultListableBeanFactory. Java: 638)
The at org. Springframework. Beans. Factory. Support. AbstractBeanFactory. GetMergedLocalBeanDefinition (AbstractBeanFactory. Java: 1159)
The at org. Springframework. Beans. Factory. Support. AbstractBeanFactory. DoGetBean (AbstractBeanFactory. Java: 282)
The at org. Springframework. Beans. Factory. Support. AbstractBeanFactory. GetBean (AbstractBeanFactory. Java: 195)
The at org. Springframework. Context. Support. AbstractApplicationContext. GetBean (AbstractApplicationContext. Java: 973)
At com. Sxyd. Aftersale. Test. ImplTest. Main (30) ImplTest. Java:
Novice to learn, the great god help solve under

CodePudding user response:

Packaged jar depend on whether the package is packaged together?
If depend on the package not packaged together, try to use Java - cp your_class_path - jar your_jar. Jar to specify the classpath to try to run, which specify the classpath containing your rely on the package

CodePudding user response:

You look at AfterSaleMapper. XML file inside of the namespace is called AfterSaleMapper,
  • Related