context:component-scan is not bound ,, hmmmm what what ,, kan mau pindah ke spring annotaion kq gtu
Bismillah
q> gogling bentar , ketemu soal xmlns, xmlns:context="http://www.springframework.org/schema/context"
tambahkan deklarasi xmlns:context="http://www.springframework.org/schema/context" pada tag beans (lihat konfigurasi spring untuk annotation di bawah)
q> pada spring annotation baris ini harus disertakan (pada file applicationContext.xml)
[sourcecode language="xml"]<context:component-scan base-package="com.ipi.zk652" />[/sourcecode]
yang berfungsi untuk melakukan scanning / register bean atau component pada aplikasi kepada spring.
q> applicationContext.xml untuk spring xml ( bukan annotation)
[sourcecode language="xml"]
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
</beans>
[/sourcecode]
q> applicationContext.xml untuk spring annotation
[sourcecode language="xml"]
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd">
<context:component-scan base-package="com.ipi.zk652" />
</beans>
[/sourcecode]
Alhamdulillah
No comments:
Post a Comment