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

How to set context root of a web app using spring 4.1 using annotations

I am trying to set up a simple web app using spring annotations. I am referring to sample projects given in spring site. Can anyone let me know how can I set the context root to below given…
lakshitha
  • 77
  • 2
  • 9
0
votes
1 answer

@Named annotation can't load a bean in a Servlet - javax.naming.NameNotFoundException: Name student is not bound in this Context

I originally used @Component for a bean(Student.java) that is being called in a Servlet. I changed @Component to @Named. I used to use following code to get the student bean in the Servlet. Student student =…
user3123690
  • 1,053
  • 5
  • 17
  • 27
0
votes
1 answer

sts stops maintaining or generates .aj files

This is driving me complete mad!!! For some reason STS randomly stops generating or maintaining .aj files! All of our work uses annotations through out the code and everything usually works, changes to these annotations or deleting java files…
0
votes
1 answer

while using Spring ApplicationContext as in the example below, are annotations taken care of

public class SomeClass { @Autowired public WaterContainer wc; private static int count = 0; SomeClass(){ ++count;} public static int testmethod() { return count; } public static void main(String[] args) { …
shrewquest
  • 541
  • 1
  • 7
  • 22
0
votes
2 answers

Spring+Hibernate configuration, null SessionFactory

I've been searching extensively for hours, seeing different scenarios with different approaches for a specific/common problem, but having no luck to solve a very simple Null SessionFactory. Here are my classes, I made it as short as possible so…
0
votes
0 answers

Adding and implementing interfaces with Annotations and Spring AOP?

is it possible to implement an interface using Annotaitons/Spring AOP/Proxies? For example, I have the simplified interface Foo. The first and second method usually only return a value. These values could be annotated on class level like shown in…
Kai Schlegel
  • 183
  • 2
  • 11
0
votes
1 answer

Spring : @Autowired not working in @Service, @Repository Class but working in @Controller class

I need help in setting up my spring applciation. I am getting null pointer exception while accessing the @Autowired fields in @Service and @Repository classes. But I am getting proper value in @Controller class. I tried to debug. In DEBUG mode when…
0
votes
1 answer

Spring JavaConfig and annotation based injection

I have configured my Spring application as below: Class A{ @Resource private B objB; @Resource private C objC; } Class B{} Class C{} @Configuration Class SpringConfigs{ @Bean public A objA(){ return new A(); } @Bean …
0
votes
1 answer

Spring: ModelAttribute doesn't get called

I have a controller used to display a list of project, but I cannot find why a @ModelAttribute method doesn't get called. This is my controller: @Controller(value = "projectListController") @RequestMapping(value = "VIEW") public class…
0
votes
1 answer

Spring annotation for Reactor.receive

I am working on Spring Reactor to write REST Services. I was wondering if there is an annotation to Reactor.receive method like we have @Selector and @ReplyTo Such that : in.consume(req -> reactor.sendAndReceive("test.httprequests",…
Kaushal Panjwani
  • 1,263
  • 10
  • 11
0
votes
0 answers

Autowiring Beans defined in XML into Spring's Java Config

I have an xml configuration of spring as below:
dharam
  • 7,882
  • 15
  • 65
  • 93
0
votes
2 answers

How to use @SessionAtribute in spring MVC

can someone give a reference for @sessionattribute annotation in Spring MCV. How to save an object and get that object.
bula
  • 8,719
  • 5
  • 27
  • 44
0
votes
0 answers

Reading integer array from properties file, using @Value annotation

I have the following in my properties file, increments = 10,20,30 I want to read these properties in my POJO, @Value("#{'${increments}'.split(',')}") List increments; List getIncrements(){ return increments; } And then use…
ufdeveloper
  • 387
  • 6
  • 19
0
votes
1 answer

Custom Annotation in spring

I am trying to implement custom annotation in spring as follows:- Test annotation is as follows @Documented @Target( { ElementType.METHOD, ElementType.FIELD }) @Constraint(validatedBy=CheckUser.class) @Retention(RetentionPolicy.RUNTIME) public…
user3640507
  • 65
  • 1
  • 7
0
votes
1 answer

spring2.5 Neither BindingResult nor plain target object for bean name "xxx" available as request attribute

please help me... i'm using spring 2.5 i got a error message. this javax.servlet.ServletException: javax.servlet.jsp.JspTagException: Neither BindingResult nor plain target object for bean name 'user' available as request attribute Here URL…
Double J
  • 37
  • 1
  • 2
  • 11