After struggling with this for a few days (searching SO for similar questions, doing trial & error), I am tempted to give up… So the problem is I have a REST service based on Spring Boot using Spring Security and JWT for authentication. Now I want to secure some of the methods to be only called by authorized people using
Tag: spring-boot
How to disable Google Cloud Platform integration?
I have these two dependencies in my POM file: I’d like to disable these GCP features in certain profiles. I need to test my app locally but GCP keeps getting in the way. Answer Spring depends on auto-configuration when setting up the application. In many cases, it scans the classpath for certain dependencies, and if they are present, auto-configuration is
What does “Process finished with exit code 1” mean in intellij-idea?
I got the error “Process finished with exit code 1” when I was running my Java code. I am using Intellij IDEA 2018.3. Below is the error log I got. Answer While running a Java application in Intellij Idea, after the program execution, JVM prints the exit code to the console. If the program terminates without any exception, exit code
flyway schema giving IllegalArgumentException
On running flyway schema I’m receiving this exception.using Java 8 with spring boot. Flyway is not able to initialize. Answer Check the flyway_schema_history table, there you will see that you have an entry with installed_rank value set to 0, delete the row and run your application again. This will sort the issue out.
Why is my IE browser getting launched twice with Selenium and Cucumber?
I am writing very basic automation test with Selenium-Cucumber that is launching an IE browser and closing it at the end. The problem is that the browser gets launched twice. The test does not have much it other than few System.out statements. I am kind of new to both selenium-based automation testing and Cucumber and not able to understand why
JPA Lazy loading is not working in Spring boot
I googled a lot and It is really bizarre that Spring Boot (latest version) may not have the lazy loading is not working. Below are pieces of my code: My resource: My service: My Entity: And when debugging, I still getting all lazy loaded attributed loaded. See image below. One of my questions is could Jackson be involved in such
How to get only one role from a set of roles
I’m trying to implement a simple spring security project where basically I have user and role entities. I have a set of roles “ADMIN” and “USER”. Now I want to assign only “USER” role along with creating a new user. I have tried to use List and collections with the same problem. The User entity has Set<Role> And Role entity:
How can I use @WithMockUser and pass my username and password from my properties file?
I am writing an integration test where the application has a basic auth applied with spring security. I am using @WithMockUser to tell mockMVC how to authenticate with my endpoints. This works but I am wondering if I can replace those strings with references to the values in my application.properties file similiar how you can do: Is the above possible?
Spring Cloud Gateway for composite API calls?
I am starting to build a Microservice API Gateway, and I am considering Spring Cloud to help me with the routing. But some calls to the Gateway API will need multiple requests to different services. Lets say I have 2 services: Order Details Service and Delivery Service. I want to have a Gateway endpoint GET /orders/{orderId} that makes a call
How to apply the PathPatternParser introduced in Spring 5?
I want to create a GET request that takes a filepath as a path variable. As described in the Spring documentation found here, this should be possible by using the following: /resources/{*path}. I am using Spring Boot 2.1.2 which uses Spring 5. However when I set up my controller method like this, the request doesn’t match the route. An expected