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

After reloading jetty-maven-plugin 503's

I am experimenting with the jetty-maven-plugin and no-xml spring configurations, but am having issues using jettys automatic class reloading. When I was using a web.xml everything worked fine. The WebApplicationInitializer.java replaces the old…
austinbv
  • 9,297
  • 6
  • 50
  • 82
0
votes
1 answer

Bean not getting autowired using AnnotationConfigApplicationContext

I am fairly new to Annotation Driven Spring which got introduced after Spring 2.5. I have been fairly comfortable with the XML based configuration and I have never had any problems getting beans to AutoWire using XMl approach of loading the Spring…
Yogendra
  • 331
  • 5
  • 21
0
votes
0 answers

Spring Data x Neo4J embedded configuration

my application just tests if the environment is basically working. therefore i set up a testclass corresponding to the "Hello Worlds" example which can be found in the gitHub repository of SpringSource. Neo4j is included as static web app and runs…
Ben Matheja
  • 115
  • 2
  • 2
  • 12
0
votes
0 answers

Spring MVC - The @Controller annotation does not get autodetected

I am new in spring, therefore maybe my question is stupid! I am trying to add a controller to Spring's Petclinic example. However, the mappings in this controller do not work and I get 404 error. I added the same mapping to the other existing…
mahsa.teimourikia
  • 1,664
  • 9
  • 32
  • 64
0
votes
1 answer

Creating multiple pages in spring mvc using annotation

I want to create a sample project in spring mvc using the annotation method where the user can navigate to one page to another by clicking buttons.I am new to spring mvc i had created a sample project for single page display I am expecting your…
user2298758
  • 47
  • 2
  • 6
  • 14
0
votes
1 answer

Spring MVC @modelattribute in proxied controller

I have a controller which has an interface as proxy @Controller public class MyController implements IMyController{ public FormBean getCommand(){ return new FormBean(); } public String onLoad(HttpServletRequest…
Srini
  • 420
  • 1
  • 5
  • 17
0
votes
1 answer

create beans with annotation spring

In struts2 i almost did not use any xml configs and used much of annotations for MVC. I build a small application in that way using struts2. Now i want to develop same project using spring 3.2. Now i want to use annotation to create beans and…
Aadam
  • 1,521
  • 9
  • 30
  • 60
0
votes
2 answers

Java - Reflection - How to get @RequestHeader value using reflection

Following is my method : @PreAuthorize("isAuthenticated() and hasPermission(#request, 'CREATE_REQUISITION')") @RequestMapping(method = RequestMethod.POST, value = "/trade/createrequisition") public @ResponseBody void…
Java Questions
  • 7,813
  • 41
  • 118
  • 176
0
votes
1 answer

java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'RegistrationBean' available as request attribute

I am getting this exception : java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'RegistrationBean' available as request attribute This is my controller class @Controller public class…
user2251798
  • 323
  • 1
  • 3
  • 5
0
votes
1 answer

@Value place holder not resolving values in certain spring beans

I have a situation and im trying to figure out why it is so. The scenario is I have a class A that implements an operation exposed by a webservice. For each request for the operation a new instance of A is created. The entire thing is manged by…
broun
  • 2,483
  • 5
  • 40
  • 55
0
votes
2 answers

Error while applying session scope to a bean in spring

I tried to change the scope of a bean using @Scope annotation. That bean is actually working as MessageSource and used for internationalization purpose. The schema in mvc-dispacher-servlet.xml is as follows:
Prashant
  • 692
  • 2
  • 11
  • 26
0
votes
2 answers

Should I use annotations in spring for my project?

I just had one query: Iam developing one internal project myself (mixing of spring, hibernate, dao).. Iam thinking like this: Just using annotations only for hibernate and xml configurations in case of spring. what u suggest me? (Using annotations…
Irwin
  • 105
  • 1
  • 2
  • 7
0
votes
1 answer

How do I find all documents (in a collection) in mongodb using the @Query annotation

The @Query annotation makes it possible to specify a MongoDB query for a particular method. An example might be @Query("{ 'firstname' : ?0 }"). But what should the parameter to @Query be if I just want to find all documents without specifying a…
chrisjleu
  • 4,329
  • 7
  • 42
  • 55
0
votes
1 answer

How to use Spring Transaction when using GenericApplicationContext

When using Distributed Mysql Database, I've Created multiple dataSources, sessionFactory using BeanDefinitionBuilder But transactional annotation doesn't seem to work when I execute Insert SQL using getBean('bean name') method below (…
0
votes
2 answers

Spring MVC WARNING: No mapping found for HTTP request with URI

My web.xml content is: springDispatcher org.springframework.web.servlet.DispatcherServlet 1
nebula
  • 3,932
  • 13
  • 53
  • 82