@@rkroy39 Basically “uploads” folder ki ander ki files (static files) ka link usne access nahi kiya directly wo karne ke liye hamne WebConfig class banai aur use implement kiya *WebMvcConfigurer* interface se. *WebMvcConfigurer* interface se ham Spring MVC ki configuration change kar sakte hai Esme hamne *addResourceHandlers* menthod override kiya hai . Es method se ham static resources ki handling ko configure karte hai. Static resources image, css ya js ho sakti hai. Es method ke ander hamne url pattern /uploads/** ko map kiya hai drive ki physical location ke sath for “file:/uploads/“ Simple me samjhe to es se apko http based links mil jayenge jo apke upload folder ki files ko access kar sakenge. Wahi link jab ham image tag me dalenge to image show hogi.
Very nice
@@rkroy39 thanks 🙂👍
What was the reason of non display of image at first?
@@rkroy39
Basically “uploads” folder ki ander ki files (static files) ka link usne access nahi kiya directly wo karne ke liye hamne WebConfig class banai aur use implement kiya *WebMvcConfigurer* interface se.
*WebMvcConfigurer* interface se ham Spring MVC ki configuration change kar sakte hai
Esme hamne *addResourceHandlers* menthod override kiya hai . Es method se ham static resources ki handling ko configure karte hai.
Static resources image, css ya js ho sakti hai.
Es method ke ander hamne url pattern /uploads/** ko map kiya hai drive ki physical location ke sath for “file:/uploads/“
Simple me samjhe to es se apko http based links mil jayenge jo apke upload folder ki files ko access kar sakenge.
Wahi link jab ham image tag me dalenge to image show hogi.