I have the following line of code in my Spring Framework 5.3.29 application:
ApplicationContext context = new ClassPathXmlApplicationContext("classpath:beans.xml");
I've tried it both with and without the "classpath" prefix to the filename.
Here 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 the line of code above just never returns. Any ideas?
Comment From: bclozel
Thanks for getting in touch, but it feels like this is a question that would be better suited to Stack Overflow. As mentioned in the guidelines for contributing, we prefer to use the issue tracker only for bugs and enhancements. Feel free to update this issue with a link to the re-posted question (so that other people can find it) or add some more details if you feel this is a genuine bug.
A minimal sample application (removing everything you can and still make it fail) would be a good start for a question as this code snippet is missing a lot of information.
Comment From: jwhance
Well that's disappointing! In fact I did ask this on Stack Overflow and the question has received no traction:
I really do think this is an issue with Spring Framework as older versions, say v3.x don't do this.
Comment From: bclozel
There is quite a gap between Spring Framework 3.x and 5.x generations. Your question on SO doesn't show critical information - maybe sharing a complete sample application on github would help.