Skip to content
Advertisement

Tag: spring

Do you need a database transaction for reading data?

When I try to read data from the database, at least using ((Session)em.getDelegate()).createCriteria() an exception is throws saying that a transaction is not present. When I add the annotation: it works fine. However, since reading will happen million of times per second to access and read data, I want to make sure that our environment is not clogged up unnecessarily.

Immutable @ConfigurationProperties

Is it possible to have immutable (final) fields with Spring Boot’s @ConfigurationProperties annotation? Example below Approaches I’ve tried so far: Creating a @Bean of the MyProps class with two constructors Providing two constructors: empty and with neededProperty argument The bean is created with new MyProps() Results in the field being null Using @ComponentScan and @Component to provide the MyProps bean.

Spring Boot with container security

I’ve been using spring boot for some projects lately and I really like it. For a new project, we’d like to use tomcat-users.xml for really basic authentication, but I can’t figure out how to use the mechanism without a web.xml file. Most people using spring boot seem to be using spring security. Is it possible to use tomcat container security

Spring Security 3 – always return error 302

I use Spring 4 to create a simple application. Recently, I’m adding Spring Security 3 to the project but always get the Error Code 302 ( so it redirect to home page always ). Here is my SecurityConfig: I have a Controller called AccountController: My WEB-INF structure: The flow is like: User access the web site with http://mylocal:8080/moon => it

Spring JMS(ActiveMQ) delayed delivery of messages

We’re trying to set a delay on some JMS messages, so that a message will only be added to the queue/ received by the listener after x time. So far we’ve tried 2 approaches that didn’t work. 1) According to the spring documentation, we can set the delivery delay on the JMSTemplate. This is the sample code we tried: However,

How to convert a multipart file to File?

Can any one tell me what is a the best way to convert a multipart file (org.springframework.web.multipart.MultipartFile) to File (java.io.File) ? In my spring mvc web project i’m getting uploaded file as Multipart file.I have to convert it to a File(io) ,there fore I can call this image storing service(Cloudinary).They only take type (File). I have done so many searches

Advertisement