I did find this previous question but this does not seem to be my issue:
Spring hangs when loading bean definitions
The situation is with Spring Framework 5.3.29 under OpenJDK8. I have this code:
System.out.println("Loading beans.xml from classpath");
ApplicationContext context = new ClassPathXmlApplicationContext("classpath:beans.xml");
System.out.println("Loaded beans.xml from classpath.\nRunning helloWorld.");
and this is my beans.xml:
<?xml version = "1.0" encoding = "UTF-8"?>
<beans xmlns = "http://www.springframework.org/schema/beans"
xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation = "http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id = "helloWorld" class = "net.application.spring.HelloWorld">
<property name = "message" value = "Hello World!"/>
</bean>
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.microsoft.sqlserver.jdbc.SQLServerDriver" />
<property name="url" value="jdbc:sqlserver://blahblahblah" />
<property name="username" value="some_user" />
<property name="password" value="some_password" />
</bean>
<bean id = "exceptionDataDAO" class = "net.application.spring.ExceptionDataDAOImpl">
<property name="dataSource" ref="dataSource" />
</bean>
</beans>
When I run the application, with or without debug in VSCODE, it runs normally. But if I build a JAR file and try to run that, the application just hangs at:
ApplicationContext context = new ClassPathXmlApplicationContext("classpath:beans.xml");
I'm building using Maven with:
mvn clean compile assembly:single