Troubleshooting issues with resource mapping in Spring 5 without the need for XML setup

I'm having trouble loading resources with the given configuration. Can anyone help out? I am working with Spring 5 and not using any XML configuration. Below is my resource handler function in the configuration page:

@Override
   public void addResourceHandlers(ResourceHandlerRegistry registry) {
       registry.addResourceHandler("/resources/**").addResourceLocations("/resources/");
   }

Here is how I have referenced the resources in my JSP page:

<link rel="stylesheet" type="text/css" href="resources/vendor/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="resources/css/util.css">
<link rel="stylesheet" type="text/css" href="resources/css/main.css">

This is where my resource folder is located: resource location image

Answer №1

After thoroughly investigating the issue, I discovered a solution. All the information provided in the previous question was accurate. The root of the problem lied within the spring security configuration. It was necessary to include specific code in order to bypass the security measures for loading the resource in the spring security config file.

public void configure(WebSecurity web) throws Exception {  web.ignoring().antMatchers("/resources/**");

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Unable to fetch the data from HTML input field using autocomplete feature of jQuery UI

I am facing an issue with my html autocomplete textbox. Whenever I try to enter an address like "New York" and click on the submit button, it does not retrieve the input value and returns no value. Test.aspx <!--Address--> <div class="form-g ...

What steps can be taken to deter users from bookmarking URLs?

On my website, the webpages are dynamically generated using the GET method to fetch variables from a specified URL. For instance, consider the code on the main page: index.php <p><a href="/dynamic.php?name1=value1&amp;name2=value2">next p ...

What is the most effective method for creating a dark background with light text in Bootstrap without using SASS?

I recently created a new website using Bootstrap 5 and set the background color to black (#000000) by adding some CSS styling. However, I noticed that this change had unintended consequences on the appearance of various elements such as drop shadows, modal ...

Utilizing the value selected in a form to trigger an action method without the use of a query

I am currently utilizing pug to generate pages for my nodeJS server. In this particular case, I am attempting to use the value selected in a form select option to dynamically change the action method. Essentially, the goal is to utilize the group name sel ...

The sticky position is malfunctioning even when there is no parent element with the overflow hidden property

// observer for feature section let featuresSection = document.querySelector('#featuresSection'); let callbackFeature = (items) => { items.forEach((item) => { if (item.isIntersecting) { item.target.classList.add("in ...

What is the mechanism behind the integration of Cross Origin functionality between Spring Boot and Angular CLI?

I came across this helpful Spring/Angular tutorial that I've been following. However, when I try to run my application, I encounter the following error: The browser is blocking access to XMLHttpRequest at 'http://localhost:8080/api/employees&ap ...

Tips for adjusting the icon size within the <IconContext.Provider> dynamically

Currently, I am using the 'IconContext.Provider' tag to style my icons from the 'react-icons' library. Are there any solutions available to dynamically change the size of the icon based on the size of my media? Is using the global styl ...

The CSS styles do not seem to be taking effect on the Bootstrap

Here's a snippet of code extracted from my website's html and css files. My intention is to make the navbar slightly transparent with centered links, but for some reason, the css styles are not applying correctly to the navbar. HTML <body ...

The div element moves to the right as soon as the drop-down menu pops up

Currently, I am facing an issue with aligning an image inside a div that is centered in an outer-wrapper. The outer-wrapper contains a horizontal menu at the top with 5 sub divs displayed inline. I have implemented CSS for a drop-down menu that appears whe ...

CSS radio button not showing up on Safari browser

I am encountering an issue with my vue app where it functions correctly on Google Chrome but experiences problems on Safari. Specifically, the issue arises with components containing radio buttons. Upon clicking on a radio option, the selected color (blue) ...

Creating HTML Email with PHP

Having some trouble with sending HTML emails using PHP. Everything seems to be working fine on Gmail, Yahoo, etc. However, when using my cpanel (Horde Email Client), the text is appearing as an attachment and not displaying any body content. Here are the ...

Tips on building a blog using solely index.html, style.css, and script.js files

Looking for inspiration for blog listing pages? Check out some examples like: HubSpot's marketing blog or iGoMoon's blog. I'm trying to figure out where I should start. Should I begin with the first line of code? Or can I import sample code ...

When viewed through the Firefox browser on an Android device, the text on the webpage suddenly enlarg

I currently have the following content displayed on my website: <div style="font-size: 11px; line-height: 17px; text-align: left;"> <p>lorem ipsum etc etc</p> </div> Strangely, despite setting the font size to 11px, the te ...

How can I use Selenium to transfer XML data onto a webpage?

Having some trouble with my Selenium automation task - I have an XML input that needs to be pasted into a text box on the browser, then click submit. The result will be displayed after processing, which I need to verify. Can this be accomplished using Sel ...

The issue arises when trying to implement CSS keyframes with a CSS image slideshow

I'm currently troubleshooting a CSS slideshow that isn't functioning properly. The issue lies within the keyframes. I'm attempting to make the images come down from the top mask and then have the previous image go back up into the mask. This ...

Employing JavaScript to insert a JSON value as a parameter in an HTML element's attribute

In a JSON file, I have "img" properties with .jpg file paths as their values (e.g "images/image.jpg"). I am attempting to insert these values into the 'src' attribute of existing HTML elements. Below are my attempts so far: I tried creating te ...

Tips for arranging images of varying heights on separate lines so they appear cohesive as a group

I've been working with masonry.js but I'm still not achieving the effect I want. Javascript:` var container = document.querySelector('#container'); var msnry = new Masonry( container, {columnWidth: 200, itemSelector: '.item' ...

Comparison of Timeouts in HTML Forms: POST vs GET

I created a basic HTML form with a text box and a submit button that redirects to the same page and displays the input text. It came to my attention that when I use the POST method to send the input text data, it only functions properly if the page has be ...

Creating a CSS grid layout with an unspecified number of columns all set to equal width

Currently, I am in the process of designing a navigation bar using grids. In essence, when the user is an admin, there should be two additional links at the end of the bar. These links need to have the same width and should not be affected by the amount of ...

Remove advertisements from a website on an Android device using Java programming

Currently, I am developing an application that will open a webpage within a webview. I have the ability to retrieve the HTML content from the page, and in order to improve loading speed, I am attempting to remove any ads present on the webpage. Despite e ...