Can we change the location of springBeanConfiguration file in spring mvc?
up vote
0
down vote
favorite
I have developed a Spring MVC web application. In this application I have two containers and the location of the spring bean configuration file is:
/WEB-INF/dispatcher-servlet.xml
I have changed the name of the spring bean cfg file but I also want to change the location to:
/com/nt/cfg/applicationContext.xml
However, Spring is not recognizing any location other than /WEB-INF/
java spring-mvc web-inf deployment-descriptor
add a comment |
up vote
0
down vote
favorite
I have developed a Spring MVC web application. In this application I have two containers and the location of the spring bean configuration file is:
/WEB-INF/dispatcher-servlet.xml
I have changed the name of the spring bean cfg file but I also want to change the location to:
/com/nt/cfg/applicationContext.xml
However, Spring is not recognizing any location other than /WEB-INF/
java spring-mvc web-inf deployment-descriptor
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have developed a Spring MVC web application. In this application I have two containers and the location of the spring bean configuration file is:
/WEB-INF/dispatcher-servlet.xml
I have changed the name of the spring bean cfg file but I also want to change the location to:
/com/nt/cfg/applicationContext.xml
However, Spring is not recognizing any location other than /WEB-INF/
java spring-mvc web-inf deployment-descriptor
I have developed a Spring MVC web application. In this application I have two containers and the location of the spring bean configuration file is:
/WEB-INF/dispatcher-servlet.xml
I have changed the name of the spring bean cfg file but I also want to change the location to:
/com/nt/cfg/applicationContext.xml
However, Spring is not recognizing any location other than /WEB-INF/
java spring-mvc web-inf deployment-descriptor
java spring-mvc web-inf deployment-descriptor
edited Nov 9 at 17:15
Graham
3,461123558
3,461123558
asked Nov 9 at 15:24
vinay pratap singh
92
92
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
up vote
0
down vote
You just need to declare de route when you create the ClassPathXmlApplicationContext:
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
The default location is the resources folder.
Hope this help you.
no zaloan i am not worry about to create container explicitly i wan to change the location deployment-descriptor of spring mvc DispatcherServlet supply WebApplicationContext container that is by default search spring bean configuration file in /WEB-INF/ directory
– vinay pratap singh
Nov 9 at 16:35
add a comment |
up vote
0
down vote
The answer is YES, you can change the name and location of the configuration file but you have to make spring aware of the new name and location.
ApplicationContext context = new ClassPathXmlApplicationContext("context.xml");
It will load the context from context.xml
file (context.xml should be present in classpath).
You can create new Applicationcontext by passing desired XML file as parameter to constructor.
So after changing name and location of the file you have to register here for spring reference so that spring can find the configuration file.
no i am not interested to create explicitly create container by user in spring dispatcher servlet already provide predefined ioc container WebApplicationContext with fixed location /WEB-INF/dispatcher-servlet.xml but i want to change the location of spring bean cfg file in eclipse where our java classes are reside
– vinay pratap singh
Nov 11 at 7:18
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
You just need to declare de route when you create the ClassPathXmlApplicationContext:
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
The default location is the resources folder.
Hope this help you.
no zaloan i am not worry about to create container explicitly i wan to change the location deployment-descriptor of spring mvc DispatcherServlet supply WebApplicationContext container that is by default search spring bean configuration file in /WEB-INF/ directory
– vinay pratap singh
Nov 9 at 16:35
add a comment |
up vote
0
down vote
You just need to declare de route when you create the ClassPathXmlApplicationContext:
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
The default location is the resources folder.
Hope this help you.
no zaloan i am not worry about to create container explicitly i wan to change the location deployment-descriptor of spring mvc DispatcherServlet supply WebApplicationContext container that is by default search spring bean configuration file in /WEB-INF/ directory
– vinay pratap singh
Nov 9 at 16:35
add a comment |
up vote
0
down vote
up vote
0
down vote
You just need to declare de route when you create the ClassPathXmlApplicationContext:
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
The default location is the resources folder.
Hope this help you.
You just need to declare de route when you create the ClassPathXmlApplicationContext:
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
The default location is the resources folder.
Hope this help you.
answered Nov 9 at 15:28
gonzaloan
1067
1067
no zaloan i am not worry about to create container explicitly i wan to change the location deployment-descriptor of spring mvc DispatcherServlet supply WebApplicationContext container that is by default search spring bean configuration file in /WEB-INF/ directory
– vinay pratap singh
Nov 9 at 16:35
add a comment |
no zaloan i am not worry about to create container explicitly i wan to change the location deployment-descriptor of spring mvc DispatcherServlet supply WebApplicationContext container that is by default search spring bean configuration file in /WEB-INF/ directory
– vinay pratap singh
Nov 9 at 16:35
no zaloan i am not worry about to create container explicitly i wan to change the location deployment-descriptor of spring mvc DispatcherServlet supply WebApplicationContext container that is by default search spring bean configuration file in /WEB-INF/ directory
– vinay pratap singh
Nov 9 at 16:35
no zaloan i am not worry about to create container explicitly i wan to change the location deployment-descriptor of spring mvc DispatcherServlet supply WebApplicationContext container that is by default search spring bean configuration file in /WEB-INF/ directory
– vinay pratap singh
Nov 9 at 16:35
add a comment |
up vote
0
down vote
The answer is YES, you can change the name and location of the configuration file but you have to make spring aware of the new name and location.
ApplicationContext context = new ClassPathXmlApplicationContext("context.xml");
It will load the context from context.xml
file (context.xml should be present in classpath).
You can create new Applicationcontext by passing desired XML file as parameter to constructor.
So after changing name and location of the file you have to register here for spring reference so that spring can find the configuration file.
no i am not interested to create explicitly create container by user in spring dispatcher servlet already provide predefined ioc container WebApplicationContext with fixed location /WEB-INF/dispatcher-servlet.xml but i want to change the location of spring bean cfg file in eclipse where our java classes are reside
– vinay pratap singh
Nov 11 at 7:18
add a comment |
up vote
0
down vote
The answer is YES, you can change the name and location of the configuration file but you have to make spring aware of the new name and location.
ApplicationContext context = new ClassPathXmlApplicationContext("context.xml");
It will load the context from context.xml
file (context.xml should be present in classpath).
You can create new Applicationcontext by passing desired XML file as parameter to constructor.
So after changing name and location of the file you have to register here for spring reference so that spring can find the configuration file.
no i am not interested to create explicitly create container by user in spring dispatcher servlet already provide predefined ioc container WebApplicationContext with fixed location /WEB-INF/dispatcher-servlet.xml but i want to change the location of spring bean cfg file in eclipse where our java classes are reside
– vinay pratap singh
Nov 11 at 7:18
add a comment |
up vote
0
down vote
up vote
0
down vote
The answer is YES, you can change the name and location of the configuration file but you have to make spring aware of the new name and location.
ApplicationContext context = new ClassPathXmlApplicationContext("context.xml");
It will load the context from context.xml
file (context.xml should be present in classpath).
You can create new Applicationcontext by passing desired XML file as parameter to constructor.
So after changing name and location of the file you have to register here for spring reference so that spring can find the configuration file.
The answer is YES, you can change the name and location of the configuration file but you have to make spring aware of the new name and location.
ApplicationContext context = new ClassPathXmlApplicationContext("context.xml");
It will load the context from context.xml
file (context.xml should be present in classpath).
You can create new Applicationcontext by passing desired XML file as parameter to constructor.
So after changing name and location of the file you have to register here for spring reference so that spring can find the configuration file.
answered Nov 10 at 5:17
Alien
4,28521023
4,28521023
no i am not interested to create explicitly create container by user in spring dispatcher servlet already provide predefined ioc container WebApplicationContext with fixed location /WEB-INF/dispatcher-servlet.xml but i want to change the location of spring bean cfg file in eclipse where our java classes are reside
– vinay pratap singh
Nov 11 at 7:18
add a comment |
no i am not interested to create explicitly create container by user in spring dispatcher servlet already provide predefined ioc container WebApplicationContext with fixed location /WEB-INF/dispatcher-servlet.xml but i want to change the location of spring bean cfg file in eclipse where our java classes are reside
– vinay pratap singh
Nov 11 at 7:18
no i am not interested to create explicitly create container by user in spring dispatcher servlet already provide predefined ioc container WebApplicationContext with fixed location /WEB-INF/dispatcher-servlet.xml but i want to change the location of spring bean cfg file in eclipse where our java classes are reside
– vinay pratap singh
Nov 11 at 7:18
no i am not interested to create explicitly create container by user in spring dispatcher servlet already provide predefined ioc container WebApplicationContext with fixed location /WEB-INF/dispatcher-servlet.xml but i want to change the location of spring bean cfg file in eclipse where our java classes are reside
– vinay pratap singh
Nov 11 at 7:18
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53228581%2fcan-we-change-the-location-of-springbeanconfiguration-file-in-spring-mvc%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown