A pointcut is a bunch of codes that picks out join points and exposes data from the execution context of those join points.Following is an example of NameMethodMatch using springConfig.xml.
SimpleBean.java
package roseindia.net.bean;
public class SimpleBean {
String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public void displayName() {
System.out.println("Hello " + this.name);
}
}
MainClaz.java
package roseindia.net.main;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.ClassPathResource;
import roseindia.net.bean.SimpleBean;
public class MainClaz {
public static void main(String[] args) throws Exception {
BeanFactory beanFactory = new XmlBeanFactory(new ClassPathResource(
"springconfig/config.xml"));
SimpleBean simpleBean = (SimpleBean) beanFactory.getBean("testBean");
simpleBean.displayName();
}
}
config.xml
<?xml version="1.0" encoding="UTF-8"?>
|
| Hello Vinay |
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.