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 - Autowiring a map

I have a map in my spring xml defined as follows
Damien Gallagher
  • 981
  • 4
  • 13
  • 25
0
votes
2 answers

Get DB column names from annotated bean in java

In the below bean where the annotation is mapped to a DB column , how to get the values in a string. I need all values like below "TY_CD,ACTION_CD,ID" public class SampleBO implements SQLData{ @DbColumnMap(columnName = "TY_CD") private…
ashwinsakthi
  • 1,856
  • 4
  • 27
  • 56
0
votes
1 answer

Spring MVC: @ResponseBody Get method return void

I have a controller method which should return some data. I'm wondering why despite it's GET and marked with @ResponseBody it's void. @ResponseBody @RequestMapping(value = "/{id}/data", method = GET) public void getData(....) { // < Question:…
VB_
  • 45,112
  • 42
  • 145
  • 293
0
votes
1 answer

Is there something like @PostPostRequest?

I often want to refine posted data before use it, for example public class Song() { public String[] tags; public String csvTags; public void setTagsWithCsv() { // this one should be more complicated for handling real data this.tags =…
Sanghyun Lee
  • 21,644
  • 19
  • 100
  • 126
0
votes
2 answers

@Produces({"application/x-javascript"}) not working in spring mvc version 4.0.5.RELEASE

I have created a spring application and i am also using webservices. I want to use jsonp callback function for which the media type should be {"application/x-javascript"}. This seems not to be working. it is returning json object and not…
user2768984
  • 57
  • 1
  • 11
0
votes
0 answers

Why doesn't childApplicationContext.registerSingleton(class) effect what gets autowired?

This test is failing but I don't know why or how to fix it. If I hit a break point and call mockingContext.getBean(Repository.class), it does return my mock object, but for some reason the ProductionCode returned in createProductionCodeWithMock…
Daniel Kaplan
  • 62,768
  • 50
  • 234
  • 356
0
votes
0 answers

Change Request Mapping URL in browser

I am building a Spring boot project where in all my request mapping URLs will map to respective actions in my Controller classes. For e.g., I have a feature to visit a page which shows the "Book" details given the "book_id". So the URL looks like…
0
votes
1 answer

spring Multi DataSource @Service annotation with existing error

I have a code that is an error in the Spring Framework Error Cause I know So I do not know how to solve it the question. I am being used with mybatis library I had multi DataSource of two Account DataBase I created a…
user3689808
  • 67
  • 1
  • 5
0
votes
2 answers

Sending data from AngularJS factory to a Spring Controller

I have a spring controller which should recieve data in the sessionAttribute from an angularjs factory. My Spring Controller is : @Controller @SessionAttributes("dataObject") public class ScreenDesignerController extends BaseController { /** …
GeekStyle
  • 13
  • 1
  • 9
0
votes
1 answer

Without using xml file configuration how can i use @PostConstruct and @PreDestroy?

Now based on this link http://www.mkyong.com/spring/spring-postconstruct-and-predestroy-example/ i done but in that example they using xml files so please help me to do using spring annotation or other way thanks in advance...
Sujeeth Damodharan
  • 477
  • 2
  • 7
  • 16
0
votes
2 answers

Annotation spring mvc - no mapping found

I'm fairly new to Spring mvc and would like to make annotation configuration for my app. No web.xml or anything like this. I have written two jsp pages, that I would like to access, two controller classes and one application class with main method…
Sok Pomaranczowy
  • 993
  • 3
  • 12
  • 32
0
votes
1 answer

Spring annotations messages encoding

How do I configure SpringMVC's annotation messages encoding? For example, I annotated a field of the form to be validated like this: @NotEmpty(message = "ъ") But when the error occurs, it is encoded in a wrong charset. Encoding filter in web.xml…
Max
  • 389
  • 3
  • 6
0
votes
1 answer

http 404 error in j_security_check

I am stuck with this persistent error while creating my spring 4 app. Here's my code: Initializer.java: public class Initializer extends AbstractAnnotationConfigDispatcherServletInitializer implements WebApplicationInitializer { @Override …
prog rice bowl
  • 788
  • 3
  • 19
  • 36
0
votes
0 answers

Cannot add Spring Cache advice to method - internalCacheAdvisor is created in same batch as cachable annotated bean

We have refactored some parts of our application, and after that, methods annotated with spring cachable stopped being cached although the class containing the cached method was not touched. After some debugging, we can see that after refactoring…
Andreas Lundgren
  • 12,043
  • 3
  • 22
  • 44
0
votes
2 answers

JSF2 BackingBean method not being called after Spring Security configuration done

I integrated an webapp that uses JSF 2 with Spring Security 3.2 and Spring 4.0 (compatible, see documentation, and this thread), using annotations, and I have this configuation: @Override protected void configure(HttpSecurity http) throws Exception…
John John Pichler
  • 4,427
  • 8
  • 43
  • 72