I would like to convert code from https://github.com/mattnworb/hibernate-sample
so that it would not run from test directory, but from src dir, as a class with method main. In tests the dbunit database in xml file is correclty read.
I can see several problems with transforming tests to app:
Tests are run with SpringJUnit4ClassRunner and test classes extend AbstractTransactionalJUnit4SpringContextTests. Applying this to class with main method resulted in context initialization exception.
In Java main method is always static. If I try to inject fields like
@Autowired
private SomeClass instance;
Then I cannot call it in main class, since injected field is not static (and cannot be)
What could be the solution?