Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7552301
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T10:43:35+00:00 2026-05-30T10:43:35+00:00

I have build the Spring MVC application and got it to an advanced level.

  • 0

I have build the Spring MVC application and got it to an advanced level.

Now my task is to integrate Spring Security to it. And I am now following this tutorial for spring security. Now the problem is that in my MVC application there is already a applicationContext.xml which is the parent application context definition for the MVC application.

As mention in tutorial for security, should I have to add a new application context xml file for security? which contain the code:

<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/security"
    xmlns:beans="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-2.5.xsd
                        http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.4.xsd">

    <global-method-security secured-annotations="disabled">
    </global-method-security>

    <http auto-config="true">
        <intercept-url pattern="/**" access="ROLE_USER" />
    </http>

    <authentication-provider>
        <user-service id="userDetailsService">
            <user name="username" password="password" authorities="ROLE_USER, ROLE_ADMIN" />
            <user name="test" password="test" authorities="ROLE_USER" />
        </user-service>
    </authentication-provider>
</beans:beans>

Thanks in advance.

P.S. / EDIT: Or should I just copy it to my original/existing applicationContext.xml file of my MVC application?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T10:43:36+00:00Added an answer on May 30, 2026 at 10:43 am

    There is no problem or conflict with your other context.
    You could write the security configuration into context/applicationContext-security.xml for example and then just load all your context files from the web.xml.

        <context-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>classpath*:context/applicationContext*.xml</param-value>
        </context-param>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Spring MVC to build my web application, and I have a
I have a java web application based on Spring MVC. The task is to
I have a Spring MVC based Web Application with Hibernate. Following is the directory
I have a spring-based Web Service. I now want to build a sort of
So I have a spring mvc web application that I built in IntelliJ 9,
I have a Spring-MVC 3.0 web application built with Maven. All Spring dependency versions
I have an application built on Spring MVC that uses Hibernate for all of
I have the following project solution: There is a ASP.NET MVC Web Application where
This is a really strange issue. I have developed a small MVC application and
I am using spring mvc 3.0 to build an web application. User can get

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.