Questions tagged [spring-annotations]

A common placeholder for issues related to the use of annotations with the Spring framework

The Spring Framework () provides several annotation-driven configuration options from wiring beans to managing transaction.

Annotation types

JSR support

  • JSR 107
    • @CacheResult
    • @CachePut
    • @CacheRemove
    • @CacheRemoveAll
    • @CacheDefaults
    • @CacheKey
    • @CacheValue
  • JSR 250:
    • @Resource
  • JSR 303:
    • @Valid
    • @NotNull
    • @Size, etc
  • JSR 330:
    • @Inject
    • @Named

Useful links

1301 questions
0
votes
1 answer

spring application-security configuration bean scan

In my project, I needed a custom userDetailsService, So I declaire it like this in certain package: @Service @Ihm(name = "userDetailsService")// ignore Ihm, it's just a custom annotation, which works fine public class UserDetailsServiceImpl…
ROROROOROROR
  • 959
  • 1
  • 14
  • 31
0
votes
2 answers

which annotations comes under ?

does it scan for controller,service,dao,autowired annotations only? what is it's impact on RequestMapping, ResponseBody and other hibernate-annotations line Id,Table etc. If in my project i am not using any controller,service,dao,autowired…
RBP
  • 481
  • 1
  • 9
  • 29
0
votes
1 answer

Spring @Value Annotation Not Resolving

I realize this question has been asked countless times, but none of the solutions appear to be working for my situation. I have a basic Spring-WS app I'm putting together with a single servlet context. I can see that both the @Component annotated…
kwikness
  • 1,425
  • 4
  • 21
  • 37
0
votes
1 answer

Spring MVC annotation with XML performance

I had previously used Spring MVC and hibernate annotations in my Google web application project. It is taking some time to start the application after deployment. For that reason, I am switching to a Spring MVC XML-based approach for the controller…
0
votes
2 answers

Spring annotations, read properties

I have small test project to test Spring annotations: where in nejake.properties is: klucik = hodnoticka and in App.java is: @Configuration @PropertySource("classpath:/com/ektyn/springProperties/nejake.properties") public class App { …
1ac0
  • 2,875
  • 3
  • 33
  • 47
0
votes
1 answer

Marker interface with Multiple implementations...!

I have a question regarding how to implement Marker interface through spring. I need to point my marker interface to its implemented classes. Itself marker interface dont have any of function declaration. interface A { /* No Method…
0
votes
2 answers

Spring @Scheduled annotation and Singleton class

I have created a bean of a class with default (Singleton) scope. Within the class I have a method which is scheduled to be run every hour. public class TaskService implements InitializingBean { @Scheduled(cron="0 0 */1 * * ?") public void…
Chinmay
  • 731
  • 1
  • 8
  • 19
0
votes
1 answer

@Async with outstream and thread.sleep method

A simple question on @Async annotation. For example: A method is @Async annotated and it contains thread.sleep for few seconds. And after the sleep, their is a outStream.println. Then what is the result. I have used ThreadPoolTaskExecutor as…
user3066920
  • 31
  • 1
  • 8
0
votes
1 answer

What happens to methods that are not annotated as @Transactional with annotation-driven manager

Could anyone tell us what happens to the changes done to database tables in a method that is not annotated as @Transactional but the transaction manager is annotation-driven? We assume it's up to the auto commit true or false. If auto commit is…
user2616361
  • 11
  • 1
  • 2
0
votes
1 answer

Spring - Validation of concrete models while using interface

I have the following abstract model class public abstract class Thing { private String id; private String name; ... } 3 other model classes extends it. Let's call them Rock, Paper, Scissor. Example with Paper: public class Paper extends…
0
votes
0 answers

spring 4.0.2 schema error

I am trying to upgrade my spring 3.4 application to spring 4.0.2 I imported all the spring-4.0.2 jar files but am getting errors in the dispatcher-servlet.xml if I use this code, I get Referenced file contains errors…
daoud175
  • 106
  • 1
  • 18
0
votes
1 answer

CXF Logging & cn:checks are ignored when used with

The technologies I'm using are: Apache CXF, Spring 3.x, Struts 2.x and Hibernate 3.x I'm facing a strange problem while TransactionManager with using Apache CXF. For my application I'm using CXF logging with my web-service and CN:checknames to…
0
votes
3 answers

UserDetailsService implemented class is not injecting autowired field

i'm using acegi authentication for login . when i try to compare the values from databade i'm using the following class @Transactional(readOnly = true) @Service public class CustomUserDetailsService implements UserDetailsService { …
Akhil
  • 83
  • 4
  • 14
0
votes
1 answer

Spring and Hibernate 4: get is not valid without active transaction

I am using Spring annotations and hibernate to create a DAO. I am using Spring 3.2.5 and hibernate 4.3.3. For some reason I keep getting this exception: org.hibernate.HibernateException: get is not valid without active transaction Here is the…
msknapp
  • 1,595
  • 7
  • 22
  • 39
0
votes
1 answer

Using @Component instead of declarative declaration?

i was using declarative way to make beans the spring managed.It works fine. I am planning to go annotattion way now. I followed this Tutorial What i did is
user3198603
  • 5,528
  • 13
  • 65
  • 125