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 RestService with android client send object for RequestBody

i have a rest service in spring with tomcat server, with this declaration: public @ResponseBody User addUser(@RequestBody User user) { I need to call from an android client to it, im using androidanotations library with Spring Rest Library. My code…
colymore
  • 11,776
  • 13
  • 48
  • 90
0
votes
1 answer

How to implement

I have a trouble with . I would like to use for JSR-303 annotation. Check this image. http://s7.postimg.org/cz7itmiuj/Beze_jm_na.png
Michal Sipek
  • 536
  • 1
  • 6
  • 23
0
votes
1 answer

Java Spring Custom annotation in method

i have a problem when spring startup, the bean with class annotation @Component and method annotation @CustomAnnotation is not load in SpringContext custom annotation: `@Target(value = { ElementType.METHOD }) @Retention(value =…
0
votes
1 answer

Is it possible to declare complex class dependencies through Spring Component scanning?

Previous Problem: I have an object dependency such as this. A -> B -> C. There are multiple implementations of C. And as a result, there will be multiple instances of A, such that for each implementation for C = A instances. There is only 1…
Zombies
  • 25,039
  • 43
  • 140
  • 225
0
votes
1 answer

Mocking Spring global authentication manager

Using Spring MVC 3.2 with Spring Security 3.1 Target container is JBoss 4 (don't ask) so the servlet API is still 2.4. When testing the Spring security configuration it is written in XML and pulled into web.xml with a bunch of other stuff. Thought…
Matthew Campbell
  • 1,864
  • 3
  • 24
  • 51
0
votes
2 answers

How to do Spring DAO Autowiring

I am getting Autowiring error although I have checked online post and nothing seems to point out what the problem could be. I have successfully autowired two other DAOs but I can't seems to autwire 3rd DAO. I have even tried to copy the…
Sanjeev Rathore
  • 3
  • 1
  • 1
  • 2
0
votes
2 answers

Using @interface interface on the context

I have one interface on the legacy project which defines as follows: @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.FIELD, ElementType.METHOD}) public @interface Statistic { String name(); } .So here @interface are followed with two…
puru
  • 266
  • 5
  • 13
0
votes
1 answer

Show a properties file message when using @Pattern?

I'm using @Pattern to validate a field: @Pattern(regexp = Patterns.ZIP_CODE, message="validation.ZIP_CODE") private String zip; In my messages.properties file I have this: validation.ZIP_CODE=Must match NNNNN or NNNNN-NNNN The javadocs seem to…
user1071914
  • 3,295
  • 11
  • 50
  • 76
0
votes
1 answer

Spring-boot, unable to autowire a class.No default constructor found Exception is raised

I am new to spring-boot. After i moved a class to different package (other the one contains 'Application'), Could not instantiate bean class: No default constructor found Exception is raised. Before (workable code) package com.server; import…
Elvin
  • 477
  • 1
  • 6
  • 10
0
votes
1 answer

WebApplicationContext appears to ignore Import annotation

I am having a problem where the Spring WebApplicationContext appears to be ignoring the @Import annotation on a @Configuration-annotated config class in my web app. It is not a Spring MVC web app. The problem occurs during processing of the…
Hoobajoob
  • 2,748
  • 3
  • 28
  • 33
0
votes
1 answer

request and session attribute value returns null in @ModelAttribute method

Am using spring mvc i want to access an request attribute inside @ModelAttribute method but its giving only null @RequestMapping(value = "/abc", method = RequestMethod.GET, params = "data") public ModelAndView aaaa() { …
Monicka Akilan
  • 1,501
  • 5
  • 19
  • 42
0
votes
3 answers

How to convert to Table to List

I am using Spring mvc and hibernate.I want to put WHERE condition and get specific result then i want to convert in to LIst ,I did it like that..but give ERRORS.. Please simple tell if some one want to convert any table to list .do we shud change in…
Zcon
  • 153
  • 6
  • 18
0
votes
1 answer

Problems using getBean() with constructor args, multiple application contexts

I'm new to spring and am working on an app that uses multiple application contexts, configured using annotation. I have one context where I am creating 3 singleton beans, one of which I want to pass as an argument into the factory method for a…
Hoobajoob
  • 2,748
  • 3
  • 28
  • 33
0
votes
2 answers

Spring @PropertySource and Environment Type Conversions

I have an existing xml-based spring configuration using a PropertyPlaceholderConfigurer as follows:
Forge_7
  • 1,839
  • 2
  • 20
  • 19
0
votes
2 answers

Spring RequestMapping 404 error?

How to fix 404 error ,The requested resource is not available. viewResolver from dispatcher-servlet.xml
Moataz Aahmed Mohammed
  • 1,307
  • 5
  • 22
  • 33