Skip to content
Advertisement

Tag: spring-boot

@Transactional – rollback on Exception not working

I am using aurora mysql for one of my project, wanted to rollback db update in update2 method in case of any exception. If I add transaction on update, getting this error Access denied for user ‘root’@’localhost’ (using password: NO). Without transactional annotation, I’m able to perform db operation, there is no issue with credentials. sudo code: Can someone suggest

How to deploy a Spring-Boot-Webflux application to Tomcat standalone server?

A normal spring-web application can be deployed to tomcat standalone as war file as follows: Question: how can I deploy such an application after migrating to spring-webflux to tomcat? Docs say: https://docs.spring.io/spring-framework/docs/current/reference/html/web-reactive.html#webflux-httphandler To deploy as a WAR to any Servlet 3.1+ container, you can extend and include AbstractReactiveWebInitializer in the WAR. That class wraps an HttpHandler with ServletHttpHandlerAdapter and registers

Converting java object to xml

How can i convert java object to xml? I am trying to convert an incoming java object to xml in spring integration with a converter bean. is there another way than marshalling in Jaxb ? like using @TypeConverter. Or implementing converter class. Answer I’m not familiar with @TypeConverter, but looks that that is an EclipseLink feature for JPA. In the

value not injecting in @ReuqestBody POJO from application-dev.properties – SpringBoot Application

I am new to Java SpringBoot and I am trying to inject a default value from application-dev.properties file. Basically, the idea is to set default value to RequestObject’s id property, default value being injected(/fetched) from application-dev.properties. UseCase: In case, no data or blank data is being passed in request body of API, the code should set a default value (being

How to avoid duplicate code in Java when you require the same class in two separated applications?

For the sake of simplicity, let’s say that I have a class named “Dog”. Then I have two separated applications containing implementations of that class. Application “A” does something with the Dog class. Application “B” does another something with the Dog class. Both applications require the Dog class, hence it would be duplicated. Now let’s say for a moment that:

Advertisement