I’m following the Learn Spring 5 etc on udemy and I’m at the part where we test our application. Everything worked fine till now, i was able to connect to the postgreSQL database and all but now I’m stuck at this test failing since 2 days. I don’t understand what is causing the Test to fail. The application run but
Tag: spring
Assigning name to a org.springframework.core.io.Resource object
I am looking for a way to assign/set a filename to a org.springframework.core.io.Resource object. The object does not have a function available to do this. The getFileName method in my case returns a null. I do not want to create a multipartfile from the Resource object since my Open API spec does not accept it. Answer I achieved it like
Deploy WAR to Tomcat (Spring Boot + Angular)
I am trying to deploy the Spring Boot Application with WAR packaging to Tomcat 10. The application gets deployed successfully, however, when I try to access the endpoints it results in 404 Not Found. WAR File: application.war Tomcat webapps/application folder consists of following and index.html (Angular) have <base href=”/”> As discussed here, I have added a class AppServletInitializer which extends
How to send a body with HTTP DELETE when using WebFlux?
I want to access an HTTP API which provides a DELETE endpoint. This particular endpoint expects a list of items (which I want to delete) as JSON body. Now, my problem is, I’m using Spring Webflux. But its WebClient doesn’t give me the possibility, to send a body with a DELETE request. For a POST, I’d do this: But for
Spring authentication using ActiveDirectoryLdapAuthenticationProvider and embedded ldif
one of my clients requirement was to authenticate users against his corporate ActiveDirectory (LDAP). So I used standard ActiveDirectoryLdapAuthenticationProvider and it works like a charm. Problem is that clients AC is hidden behind firewall. It works after deployment, but I cannot reach AC during local development due to cleints security policy. So, I had an idea that maybe for dev
Strange date error between Development and Production environment
I have a strange date error that I can’t solve for days and ask for your help. I have developed in Java/Spring/Vaadin/Hibernate an app that creates a sport training every day by a user. The problem is that the training date is not displayed correctly in browser. For example, I create now a new training: On localhost shows right but
Where condition not working on related entity
I’m trying to apply the where condition on the related entity, but the result set contains all the related entity data. It appears like the filter is ignored. I have the following entities: Entity …
Are Java classes in Spring automatically a @Bean?
If I create some classes, can I automatically @Autowire those classes somewhere else without using the @Bean, @Component, @Service? Or if I want to @Autowire a class somewhere else, do I need to use the annotations described before? I want to @Autowire a class to another that uses the @Configuration and @ComponentScan annotation For example: or to achieve this.. Answer
Can’t configure antMatchers after anyRequest (Multiple antMatcher)
I am trying to configure Spring Security and get this following error: Caused by: java.lang.IllegalStateException: Can’t configure antMatchers after anyRequest This is my SecurityConfig class: I already tried call httpSecurityauthorizeRequests().anyRequest().authenticated() as mentioned here, still didn’t work …any suggestion would be helpfull. Answer
Multi-tenant hibernate doesn’t switch between tenants
I am in the middle of changing my spring + hibernate + mysql setup to be multi-tenant. First of all, I have the following in my application.properties: I am not sure if I’m supposed to make it connect to a specific schema here (test) after introducing multi-tenancy? It doesn’t make sense to me, as it’s supposed to use a default