Spring 3.0 annotation and xml configuration

Currently I see that xml configuration doesn’t take Annotation configuration in consideration.


I have a bean configured via annotaion, but in my context.xml its usage is red.
Am I missing something or it just not yet there?

Everything works fine, but the red marks just bother me.

6 comments
Comment actions Permalink

Do you have a small example snippet?

As far as I remember, annotation-driven beans used in some of our projects work in IDEA - we're using the 2.5 namespaces though.

-tt

0
Comment actions Permalink

In XML file define bean like this:

    <bean id="listener" >
        <property name="client" ref="myClient"/>
    </bean>

Here's how it really looks in IDEA:

<property name="client" ref="myClient"/>

Thies RED thing - bugs me a million:(


In Java, like this:

@Configuration
public class SpringConfig {
    
    @Bean (name = "myClient")
    public MyClient myClient() {
        return new MyClient();
    }
}


And I would like to highlight that this code works fine.

But, myClient is red, i.e. IDEA can't recognize bean configured via annotation from XML config file.

But, I hope that I'm missing something and it can work properly.

Thnx, Andrey

0
Comment actions Permalink

I though you were referring to the annotation-driven configuration, but it seems you're using Spring JavaConfig (or whatever it's called these days).
We're not using that.

0
Comment actions Permalink

Hi Andrey,

What is your @Configuration ? org.springframework.config.java.annotation.Configuration
or org.springframework.context.annotation.Configuration ?

Idea uses classpath scanning (http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/ch03s10.html)
to find proper @Configuration classes.

Do you have  <context:component-scan base-package="org.andrey12345"/> in
your configuration?

serega.

In XML file define bean like this:

 n(){return
> A.apply(null,[this].concat($A(arguments)))}|ondblclick=|onmouseout=|on
> mouseup=|onkeyup=|class=jive_text_macro
> jive_macro_code|onkeypress=|onkeydown=|lang=function(){return
> A.apply(null,[this].concat($A(arguments)))}|onmouseover=}     id="listener" >
> 
> 
> ]]>

In Java, like this:

 n(){return
> A.apply(null,[this].concat($A(arguments)))}|ondblclick=|onmouseout=|on
> mouseup=|onkeyup=|class=jive_text_macro
> jive_macro_code|onkeypress=|onkeydown=|lang=function(){return
> A.apply(null,[this].concat($A(arguments)))}|onmouseover=}@Configuratio
> n
> 
> public class SpringConfig {
> 
> @Bean (name = "myClient")
> public MyClient myClient() {
> return new MyClient();
> }
> }]]>

And I would like to highlight that this code works fine.
But, myClient is red, i.e. IDEA can't recognize bean configured via
annotation from XML config file.
But, I hope that I'm missing something and it can work properly.
Thnx, Andrey

---
Original message URL:
http://www.jetbrains.net/devnet/message/5249172#5249172



0
Comment actions Permalink

Spring3.0 annotation ,I cannot configure,If import some packages? (I am Chinese,my english is poor,please help me,my msn:    fukailong@msn.com)

0
Comment actions Permalink

Hello there.
I am having the same problem.
I use spring context 3.0.6
intelliJ 10.5.2 component based scan.

and use the @Bean tag.
Is it still not supported even though spring 3.0.x supports is fully?

0

Please sign in to leave a comment.