Skip to content
Advertisement

Tag: spring

Spring @Transactional with base and subclasses

I am confused about @Transactional annotation with base and subclasses. I have the following code with several generic subclasses derived from the base class CustomRepository<T> which implements ICustomRepository<T>. I want all the methods of the interface ICustomRepository<T> be transactional. Is it enough to put @Transactional just in the base class so that the call findAll() from sublasses also become transactional.

How to replace an old ibm mq batch V7

I’m wondering what is the best way to replace and old ibm batch java application: In fact , I have a java application which contains basically two classes and can be started using two shell files; a shell to send and message and another one to consume messages present in the Queue. sendMessage.ksh => start the application and calls send

How to access configuration beans in Spring controllers

I have a Spring Boot application that uses Spring profiles to create environment specific configurations, for example: I have a @RestContoller that needs to access the values that the configurations load from application.properties. How can I inject the current environment specific configuration bean inside the controller? Example: Answer If you need to access values from the application.properties or .yaml configuration

Data type is not updating on Database

In my entity class, I want to change the data type of a field but it’s not updating in the database. I am using PostgreSQL. I have also tried adding this: in application properties and still, it doesn’t work I don’t know why, please help, and thanks. What I have : Answer If you just created your database and doesn’t

How to not hardcoding image extensions in Java?

How to not hardcoding image extensions in Java? Above is my code. In the case statement, I have listed strings as hard-coded as jpg, jpeg…. This code is not flexible, so I’m sure there must be a better way. I’d appreciate it if you could give me a solution that I’m not aware of. Answer As one of possible ways,

Advertisement