You are on page 1of 2

Spring Setting environment::

We have to download the the spring.


add to jars..there are some set of jars that we have to add..
Spring::Understand Spring factory bean::
Spring behaves as facory of beans::
so spring lo chala beans instances untayi ::
Ex:: Tomcat is a servlet container::
means:: Tomcat contains servlet objects that are required::
we will submit what servletes we need as form of xml::
Spring is bean container::
Spring handeles whole life cycle of bean::
there are some advantages if spring handle life cycle of object::
Factory patter design pattern::
indhulo manam oka dhanni request chesthey adi manaki kavalsina object isthudhi
instead of creating instance of class
class a=new class();
class a= springobjectfactory.giveclassa();
springfactory takes an configuration file which contain data about the classes w
hich has to be instanciated
i,e.. Spring.xml
Writing code using bean factory::
----------------------------------
We have to use beanfactory to create beans to the c lasses which we submit i
n XML
BeanFactory beanfactory=new XmlLBeanFactory();
XmlBeanFactory this uses xml file which contain configuration
new XmlBeanFactory(new FileSystemResource("Spring.xml"));
This spring.xml is present in the project folder just beside pom.xml
sprint AOP::

we create aspects --some special classes
like
LoggingAspect,TransationAspects
Aspect Configuration::
writing aspects,
configure them.
--------
writing aspects::
+
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
30th video tutorial
Pointcuts--> veeti tho manam AOP ee ee methods ni interupt cheyyalo cheptham
@pointcut("execution(get*()))->ee pointcut evithey method names get tho start ch
esthamo vatannitiki apply avuthundhi
Jointpoint --> pradeen PRM lo edina method lo ki vellithey aa method name entry
ani rasadu..
manam same thing ni JoinPoint dhwara chyyagalam..
JointPoint+AOP -> pradeen manual ga rasina code
first manam methods ni select chesukovali..dhani kosam POINTCUTS
aa pointcuts medha manam JoinPoint rayali
@pointcut("within(classname along with path)")
public void allMethodsinClass(){};
eppudu ee method method Joinpoint rayali
@Before(allMethodsinClass())
public void printMethodNameAdvice(JoinPoint joinpoint) --> ee ee method ni mana
m call chesthunnamo dhani information antha JOINPOINT lo untundhi
{
sysout(joinpoint.toString())
-> this will print methodname details
}
//AOP tho manam advices lanu call cheyyochu

Joinpoint were called for methods

joinpoint.getTarget();-> to know which one called this method..for support one c
lass call other class method..
if youwant to know which one called then you can use Joinpoint.getTarget()method

}

Before("args(String)" )-> this pointcut is applicable to all the methods which
contain only one String as parameter


@Before("args(name)")
void logingAdvice(String name)
{
sysout("Name varaible passed"+name);
}

You might also like