Skip to content
Advertisement

Tag: spring

Spring: automatic rollback on checked exceptions

One way to configure Spring to rollback on a non RuntimeExceptions is using @Transactional(rollbackFor=…) annotation on the service classes. The problem with this approach is that we need to define (rollbackFor=…) for almost all the service classes which seems really redundant. My question: Is there any way to configure a default behaviour for Spring transaction manager to rollback on a

Exception during context initialization –

I’m trying to create a simple online store with spring. But the error that occurred is above my skills. I googled all I could, and I’m helpless. Since last time everything worked I created a new controller, few services and a thymeleaf template. I can post the whole project on github if anyone would be willing to check it. Posting

PageRequest constructors have been deprecated

I’m working the Spring Data Commons v2+ snapshot, and I see that the constructors for a PageRequest have been deprecated. This appears to have occurred between M1 & M2. Unfortunately, this is the only [real] implementation of the Pageable interface. I’m wondering where the effort is heading, and what a better alternative would be for current development. Answer It’s just

Thymeleaf URL with multiple variables

I’m using thymeleaf as template engine in my spring project. My Problem is: I’m trying to submit my form to url that contains two variables, something like: mysite/bla/{id}/bla/{id2} (two variables in url). So, I’m trying with this: The console shows the error: “Skipping URI variable ‘id’ since the request contains a bind value with the same name.” So, someone has

Spring Security UserDetailsService must be set Error

Just i dont understand, why customUserDetailsService doesn’t autowire There are 2 classes i use ================= And there is stackTrace Please explain me, how it’s possible. These classes have the same package, i included this package @ComponentScan annotation. And spring still complains that he cant find @Service Component. There is something easy, but i cant get it. Please help. Answer I

@PostConstruct annotation and spring lifecycle

I’m new to Spring, I would like to know: I have a java class annotated with @Component (spring) and inside I have a method annotated with @PostConstruct. The class is then referenced by @Autowired annotated field in another class. Can I assume that the class is only injected after @PostConstruct is called? Answer If you are asking is injection of

Advertisement