I tried making a simple REST API using Spring Boot. I have put the classes in separate packages. In this case, the URL mapping is not working (checked using Postman), whereas its working fine if I put them all in the same package as that of the main class. “”” Hierarchy of the packages : com.example.ProductCRUD |—–ProductCrudApplication.java (main) com.example.ProductCRUD.Controller |—–ProductController.java(controller)
Tag: spring-mvc
Use value of a local variable as global in thymeleaf
I have a variable that is obtain inside each block in thymeleaf. I want to send that variable to a certain method in my controller. The limitation is that the variable is obtain inside a block which makes it local, not accessible global.Hence I get an error while trying to use it. How can I move inside the scope to
Cant run my spring application on ubuntu with jdk11
Pls, help. Can’t run my application on ubuntu 18.04.5 Java version: openjdk 11.0.10 2021-01-19 Apache Maven 3.6.0 Maven home: /usr/share/maven Java version: 11.0.10, vendor: Ubuntu, runtime: /usr/lib/jvm/java-11-openjdk-amd64 Default locale: en_US, platform encoding: UTF-8 OS name: “linux”, version: “5.4.0-66-generic”, arch: “amd64”, family: “unix” There is app output: pom.xml: UserService.java RegistarionCotroller.java WebSecurityConfig.java Answer When initializing the WebSecurityConfig, Spring Container will attempt to
MultipartFile and nested object in a json to test post request in POSTMAN?
Wanted to test a post request in POSTMAN. Spring MVC Controller I want to send SchoolDto (POSTMAN: body->raw->json) in post request to get desired result. But I am not able to create the json which supports SchoolTimeTable (Object) and MultipartFile types. I don’t even know whether it is possible with JSON or not. Note: Same could be achieved using body->form-data
Retrieving limited columns using jpa specifications
I am using spring boot JPA specifications for executing complex queries. However, the table I am querying contains more than 20 columns and I need to pull just 3. I tried cq.multiselect(…) but it didn’t work and returned me the entity with all the columns. On investigation, I got to know that it’s a bug with specifications that’s not yet
Java code exporting workbook to current user PC instead of the actual web app host
I have a spring MVC project that I have develop for my team at work. I have an endpoint that create a workbook using apache poi, then export to .xlsx file, but my code appeared to write to file on the application host instead of user’s computer. I know I’m missing something, but I try what I found on internet
java.lang.AbstractMethodError occurs while trying to implement call inbound of nexmo SDK through rabbitMQ
I am trying to integrate call inbound feature using nexmo java SDK to my spring MVC project with help of rabbitMQ. But I keep on getting the exception below RabbitMQ Listener class where call inbound logic is implemented. POM dependencies Answer This has nothing to do with spring-rabbit; it is an incompatibility between the two library versions you are using
RestClientTest annotation fails to autocnfigure RestTemplate
I have a class with RestTemplate dependency And in the test I wish to use @RestClientTest for auto configuring the RestTemplate But the test fails with unable to find autowiring candidate for RestTemplate error. Answer In the documentation of @RestClientTest you can read: If you are testing a bean that doesn’t use RestTemplateBuilder but instead injects a RestTemplate directly, you
Unable to Run my Spring Security MVC WebApp SpringChainFilter throwing exception, rawPassword cannot be null
So I was trying to make a simple spring security hardcoded security just to check how my app is working before connecting it to the DB but before that it start showing me error 500. Here is my Configuration file Here is my webSecurity Configuration class with In memory authentication with some sample data. Here is my Servlet Initializer Class
Deployed .war generating error: template might not exist or might not be accessible
I have a spring boot application that runs fine on localhost. I access it with http://localhost:8080/home. Now I want to deploy the application to a hosting server. Generated the .war and deployed it there. Configured http://www.customdomain.com/hostingpath/ to be the root path for the app. So that should map to what locally is http://localhost:8080/. Now when I access http://www.customdomain.com/hostingpath/home I’m getting