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

Spring MVC - inject context-param from web.xml

I have defined the context params in web.xml apikey 45370652 secretkey
Keerthivasan
  • 12,760
  • 2
  • 32
  • 53
0
votes
1 answer

Does annotating a repository interface as @Component have any cons?

I have this interface: public interface liteRepository extends CrudRepository, JpaSpecificationExecutor {...} It works, all is well. However, intellij does not register this class as a spring component. If I annotate…
Eric Francis
  • 23,039
  • 31
  • 88
  • 122
0
votes
1 answer

Using @Repository, @Service and @Controller annotation giving bean creation exception?

I have created a simple spring mvc project to test the @Repository, @Service and @Controller annotation in spring using STS. But I am getting BeanCreationException. Spring is unable to create @Controller bean as it can not find the bean with…
Nikhil
  • 300
  • 1
  • 5
  • 18
0
votes
1 answer

Spring Cache: How to specify global @CacheConfig for application

I am working on setting up Spring Cache support for my Java application. I want a way to set a global @CacheConfig for my entire project because I want all cache operations in the application to use the exact same cache name and custom KeyGenerator…
ecbrodie
  • 11,246
  • 21
  • 71
  • 120
0
votes
0 answers

autowiring not working in spring controller

I google for the whole but could not figure out whats wrong in my code, and why its not autowiring. ****EMPLOYEE CONTROLLER**** import java.util.logging.Logger; import javax.servlet.http.HttpServletRequest; import…
0
votes
2 answers

Bean's property is not setting from util:list object

I have declared following list using spring util namespace in my spring configuration file: where all reference bean are…
Aasif Solkar
  • 81
  • 1
  • 12
0
votes
3 answers

NoSuchBeanDefinitionException: No qualifying bean of type found

I am making a Spring + Hibernate + Maven project. After basic login, I tried to use annotations, but got stuck there. I have tried everything possible, still can't get rid of this error NoSuchBeanDefinitionException: No qualifying bean of type found…
Piyp791
  • 649
  • 1
  • 13
  • 28
0
votes
1 answer

WebApplicationInitializer in child project

I'm creating a webapp project with Spring MVC and Maven. I'm also new using Spring annotation driven config. I want to create a parent project having all the SpringMVC configuration and the ServletContext listener for my container. Then, all my web…
jpadilladev
  • 1,756
  • 4
  • 16
  • 23
0
votes
2 answers

Don't work @autowire in Spring

I want to autowire my userService, but I'm getting an error. I have: web.xml
AndryLAt
  • 34
  • 2
0
votes
0 answers

creating multiple generated proxies

I have a spring application that uses rabbitmq-based RPCs. on the client side, I would like to generate a proxy object that delegates to the RPC based on annotated interfaces available on the classpath of the client. in a similar way, I want to be…
rmalchow
  • 2,689
  • 18
  • 31
0
votes
1 answer

Spring AspectJ Custom Annotation for Logging

I have defined a custom annotation as below. package com.xyz; @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) @Documented public @interface Loggable { String message() default "Log Message"; } My aspect class contains the below…
opuser1
  • 427
  • 7
  • 29
0
votes
2 answers

How do I define a PasswordEncoder using annotations in Spring?

I am using Spring-Boot v1.3.0.M2. I am trying to define a o.s.s.c.p.PasswordEncoder using annotations. My configuration class looks like the following. This example works fine. @Configuration @EnableWebSecurity public class WebSecurityConfig extends…
Jane Wayne
  • 8,205
  • 17
  • 75
  • 120
0
votes
0 answers

Populating a HashMap with entries from a properties file for @Value

I have properties file which has a key company.id like this company.id=key1=value1,key2=value2,key3=value4 Now, I want to store key-value pair directly in map using @Value of spring //For example, //for key in properties…
Bunty
  • 91
  • 1
  • 2
  • 11
0
votes
2 answers

How Can I convert Date String as format yyyy-MM to Date with hibernate annoation

When I tried to use @DateTimeFormat(patter="yyyy-MM") at top of my attribute, ERROR: org.hibernate.engine.jdbc.spi.SqlExceptionHelper - Bad format for DATE '2015-05' What Can I do to solve this problem?
Neil
  • 2,714
  • 11
  • 29
  • 45
0
votes
2 answers

convert code to @Bean

I'm working on a project in Spring using SpringMVC, i'm using the xml element and i want to convert my code to @Bean spring-bean.xml
yb3prod
  • 564
  • 2
  • 10
  • 22