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
3 answers

component-scan unable to locate all classes

I have a simple mavenized Spring 3.1 MVC application with running in Eclipse on a Tomcat 6.0 server. My controller is Autowiring a DAO as shown below @Autowired private UserDAO userDAO; @Component public class UserDAO extends…
Jeet
  • 311
  • 1
  • 4
  • 21
0
votes
1 answer

Refrence Spring Beans Generated From an Interface in XML Bean Definition

I have some code that generates a class from an interface. I need to reference that interface in a Spring XML configuration. Is there a Spring 3 annotations I can use on the interface such that I can reference the generated implementation using…
Rylander
  • 19,449
  • 25
  • 93
  • 144
0
votes
2 answers

@Autowired doesn't work with interceptor

I'm working on REST service which is developed using Apache-CXF. I'm using Spring 3.1 annotations for wiring the bean. I have written an interceptor which intercepts my REST method for monitoring purposes. To do this, i have to autowire my Monitor…
Pankaj
  • 3,512
  • 16
  • 49
  • 83
0
votes
3 answers

junit test case giving error

I am new to writing test cases: My controller is below : @RequestMapping(value={"/addschool" }, method = RequestMethod.GET) public final ModelAndView addschool(@ModelAttribute("addschool") Pricing pricing, Map map, …
0
votes
1 answer

Spring AOP @AfterThrowing Advice not being executed

The @AfterThrowing advice I have defined is not getting executed. Could some one take a look and please help me out? Below is the code I am using. Pom.xml
Rtn9
  • 101
  • 10
0
votes
1 answer

Not getting instance of jdbcTemplate using spring annotations

I'm using Spring jdbcTemplate for making database call but i'm not getting jdbcTemplate instance although i've autowired it. package com.mypackage.dao @Repository public class CustomerDaoImpl implements CustomerDao { private JdbcTemplate…
Pankaj
  • 3,512
  • 16
  • 49
  • 83
0
votes
1 answer

NoSuchBeanDefinitionException Spring 3.2.2 Hibernate 4 using annotation configuration building with Maven 3

What am I missing? I am trying to create a basic SpringMVC application using Hibernate. I have another SpringMVC application that I model it after and it works. I have apparently missed something and I am at a loss. Any help here would be much…
John
  • 763
  • 1
  • 10
  • 21
0
votes
2 answers

Spring Injection with annotation

How to perform Spring Injection with and ? when we use then we do not have to specify our bean for controller so how to give ref when we use…
Mayur Patel
  • 155
  • 1
  • 1
  • 10
0
votes
0 answers

RequestMapping and Controller annotations. Controller is not being hit

I've a controller with @Controller and @RequestMapping annotations. @Controller @RequestMapping(value = "/copyRightVersion") public class CopyrightAndVersionController extends BaseController { protected CopyrightAndVersionController() { …
s.r
  • 2,507
  • 3
  • 22
  • 32
0
votes
2 answers

Cannot display errors with spring

I am not able to get spring validation errors displayed on the jsp page. Here is my code. On the jsp page, when I enter a empty name, the controller code does return a ModelAndView with errors, it just doesn't display it on the jsp page. Any help…
user2440712
  • 719
  • 2
  • 9
  • 16
0
votes
1 answer

Why is hibernate forcing a transaction

I am getting a "No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here" with Spring 3.2 with Hibernate 3.3 DAO class : @Repository public class ContactDAOImpl implements ContactDAO { …
IUnknown
  • 9,301
  • 15
  • 50
  • 76
0
votes
1 answer

spring annotation for ParameterMethodNameResolver

I am using the following controller for a parameter-method resolution. @Controller @RequestMapping("/customer") public class CustomerController extends MultiActionController{ @RequestMapping(params = "action=add") public ModelAndView…
IUnknown
  • 9,301
  • 15
  • 50
  • 76
0
votes
1 answer

Error in entity retrieval

I am attempting to handle an 'entity' through annotation instead of a hibernate xml mapping. I face a situation where addition succeeds but retrieval fails - help is appreciated. Model class: @Entity @Table(name = "PERSON") public class Person…
IUnknown
  • 9,301
  • 15
  • 50
  • 76
0
votes
1 answer

Spring MVC - empty, BindingResult contains errors

I am experiencing some issues with @Valid and BindingResult not pushing errors to the returned jsp page. The BindingResult in the method, detects binding errors correctly but the only way I can currently display errors is by manually adding…
Alex
  • 5,364
  • 9
  • 54
  • 69
0
votes
1 answer

Spring MVC Annotations Based Hello World Doesn't Work

I've been trying now for about a week to get a simple Spring hello world style project running without any luck.. so I'm hoping SO can help. I'm trying to access this URL (localhost:8080/test/welcome) to display "Hello World!". My aim is to use…
Mick
  • 665
  • 2
  • 6
  • 18