반응형
package org.doit.ik;
import java.text.DateFormat;
import java.util.Date;
import java.util.Locale;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
/**
* Handles requests for the application home page.
*/
@Controller
public class HomeController {
private static final Logger logger = LoggerFactory.getLogger(HomeController.class);
/**
* Simply selects the home view to render by returning its name.
*/
@RequestMapping(value = "/", method = RequestMethod.GET)
public String home(Locale locale, Model model) {
logger.info("Welcome home! The client locale is {}.", locale);
Date date = new Date();
DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, locale);
String formattedDate = dateFormat.format(date);
model.addAttribute("serverTime", formattedDate );
return "home"; // /WEB-INF/views/home.jsp
}
}
package org.doit.ik.AOP;
public interface Calculator {
int add(int x, int y);
int sub(int x, int y);
int mult(int x, int y);
int div(int x, int y);
}
package org.doit.ik.AOP;
public class CalculatorImpl implements Calculator {
@Override
public int add(int x, int y) {
//보조기능 장착
long start = System.nanoTime();
int result = x+y; //핵심관심 사항(core concern)
long end = System.nanoTime();
System.out.printf("덧셈처리시간%d ns\n",(end-start));
return result;
}
@Override
public int sub(int x, int y) {
long start = System.nanoTime();
int result = x-y; //핵심관심 사항(core concern)
long end = System.nanoTime();
System.out.printf("덧셈처리시간%d ns\n",(end-start));
return result;
}
@Override
public int mult(int x, int y) {
long start = System.nanoTime();
int result = x*y; //핵심관심 사항(core concern)
long end = System.nanoTime();
System.out.printf("덧셈처리시간%d ns\n",(end-start));
return result;
}
@Override
public int div(int x, int y) {
long start = System.nanoTime();
int result = x/y; //핵심관심 사항(core concern)
long end = System.nanoTime();
System.out.printf("덧셈처리시간%d ns\n",(end-start));
return result;
}
}
package org.doit.ik.aop;
public interface Calulator {
int add(int x, int y);
int sub(int x, int y);
int mult(int x, int y);
int div(int x, int y);
}
package org.doit.ik.aop;
public class Calulatorimpl implements Calulator {
@Override
public int add(int x, int y) {
//보조기능 장착
long start = System.nanoTime();
int result = x+y; //핵심관심 사항(core concern)
long end = System.nanoTime();
System.out.printf("덧셈처리시간%d ns\n",(end-start));
return result;
}
@Override
public int sub(int x, int y) {
long start = System.nanoTime();
int result = x-y; //핵심관심 사항(core concern)
long end = System.nanoTime();
System.out.printf("덧셈처리시간%d ns\n",(end-start));
return result;
}
@Override
public int mult(int x, int y) {
long start = System.nanoTime();
int result = x*y; //핵심관심 사항(core concern)
long end = System.nanoTime();
System.out.printf("덧셈처리시간%d ns\n",(end-start));
return result;
}
@Override
public int div(int x, int y) {
long start = System.nanoTime();
int result = x/y; //핵심관심 사항(core concern)
long end = System.nanoTime();
System.out.printf("덧셈처리시간%d ns\n",(end-start));
return result;
}
}
package org.doit.ik.aop;
public class EX01 {
public static void main(String[] args) {
Calulator calc = new Calulatorimpl();
System.out.println(calc.add(4,2));
System.out.println(calc.sub(4,2));
System.out.println(calc.mult(4,2));
System.out.println(calc.div(4,2));
}
/*
* p 204 Charter
* 어플케이션을 다양한 공통기능이 필요로 한다
* 고유한 기능 앞에 해야될 작업들
* 공통 기능들은 어떤 특정 모듈에서만 필요로 하는 것이 안니라
* 어플리케이션 전반에 걸쳐 필요한 기능이다
* AOP 관점기능
* 중복코드필터
* AOP
* org.doit.aop 패키지 추가
* ㄴ EX01.java
* ㄴ Calulator인터페이스 추가 +-* / 추상메소드 선
* ㄴCalulatorimpl 클래스 구현
* */
}
package org.doit.ik.AOP2;
import org.doit.ik.AOP.Calculator;
public class CalculatorImpl2 implements Calculator{
@Override
public int add(int x, int y) {
//전 //공통 관심사항 제거
int result = x+y; //핵심 관심 사항(core concern)
//후
return result;
}
@Override
public int sub(int x, int y) {
//전
int result = x-y;//핵심 관심 사항(core concern)
//후
return result;
}
@Override
public int mult(int x, int y) {
//전
int result = x*y;//핵심 관심 사항(core concern)
//후
return result;
}
@Override
public int div(int x, int y) {
int result = x/y;//핵심 관심 사항(core concern)
return result;
}
}
package org.doit.ik.aop2;
import org.doit.ik.aop.Calulator;
public class Calulatorimpl2 implements Calulator {
@Override
public int add(int x, int y) {
//보조기능 장착
//전 공통관심사항 제거
int result = x+y; //핵심관심 사항(core concern)
//후
return result;
}
@Override
public int sub(int x, int y) {
//전
int result = x-y; //핵심관심 사항(core concern)
//후
return result;
}
@Override
public int mult(int x, int y) {
//전
int result = x*y; //핵심관심 사항(core concern)
//후
return result;
}
@Override
public int div(int x, int y) {
//전
int result = x/y; //핵심관심 사항(core concern)
//후
return result;
}
}
package org.doit.ik.aop2;
import org.doit.ik.aop.Calulator;
import org.springframework.context.support.GenericXmlApplicationContext;
public class EX02 {
public static void main(String[] args) {
//org.doit.aop2.[advice]패키지
// 전후 LogPrintAroundAdvice 클래스 추가
GenericXmlApplicationContext ctx = new GenericXmlApplicationContext("application-context2.xml");
Calulator calc = ctx.getBean("calcProxy",Calulator.class);
System.out.println(calc.add(4,2));
System.out.println("=2 END = ");
}
/*
* p 204 Charter
* 어플케이션을 다양한 공통기능이 필요로 한다
* 고유한 기능 앞에 해야될 작업들
* 공통 기능들은 어떤 특정 모듈에서만 필요로 하는 것이 안니라
* 어플리케이션 전반에 걸쳐 필요한 기능이다
* AOP 관점기능
* 중복코드필터
* AOP
* org.doit.aop 패키지 추가
* ㄴ EX01.java
* ㄴ Calulator인터페이스 추가 +-* / 추상메소드 선
* ㄴCalulatorimpl 클래스 구현
* */
}
package org.doit.ik.aop2.advice;
import java.lang.reflect.Method;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.aop.AfterReturningAdvice;
//대상객체가 핵심기능의 메서드를 예외없이 처리된 경우 호출되는 Advice
public class LogPrintAfterReturningAdvice implements AfterReturningAdvice{
@Override
public void afterReturning(Object returnValue, //결과값 예외없이 잘처리되는 결과값
Method method, // 메서드
Object[] args, //매개변수
Object target //대상객체
) throws Throwable {
String methodName = method.getName();
Log log= LogFactory.getLog(this.getClass());
log.info(">"+methodName+"LogPrintAfterReturningAdvice 호출됨");
}//afterReturning
}//calss
package org.doit.ik.aop2.advice;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.util.StopWatch;
//보조기능을나타내는 어드바이스
public class LogPrintAroundAdvice implements MethodInterceptor{
// 스프링AOP: 메서드 호출
//calc_add() 보조기능 장착+로그기록
@Override
public Object invoke(MethodInvocation method) throws Throwable {
String methodName = method.getMethod().getName();
Log log= LogFactory.getLog(this.getClass());
log.info(">"+methodName+"()start.");
StopWatch sw = new StopWatch();
sw.start();
// 핵심관심사항
Object result = method.proceed();//calc.add();
sw.stop();
log.info(">" + methodName + "() end.");
log.info(">" + methodName + "() 처리 시간 : " + sw.getTotalTimeMillis() + "ms");
return result;
}
}
package org.doit.ik.aop2.advice;
import java.lang.reflect.Method;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.aop.MethodBeforeAdvice;
public class LogPrintBeforeAdvice implements MethodBeforeAdvice{
@Override
public void before(Method method // add()
, Object[] args // 4,2
, Object target // 대상객체(실제 객체 clac)
) throws Throwable {
String methodName = method.getName();
Log log= LogFactory.getLog(this.getClass());
log.info(">"+methodName+":LogPrintBeforeAdvice호출됨..");
}//before
}//class
package org.doit.ik.aop3;
import javax.inject.Named;
import org.doit.ik.aop.Calulator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component("calc")
public class Calulatorimpl3 implements Calulator {
@Override
public int add(int x, int y) {
//보조기능 장착
//전 공통관심사항 제거
int result = x+y; //핵심관심 사항(core concern)
//후
return result;
}
@Override
public int sub(int x, int y) {
//전
int result = x-y; //핵심관심 사항(core concern)
//후
return result;
}
@Override
public int mult(int x, int y) {
//전
int result = x*y; //핵심관심 사항(core concern)
//후
return result;
}
@Override
public int div(int x, int y) {
//전
int result = x/y; //핵심관심 사항(core concern)
//후
return result;
}
}
package org.doit.ik.aop3;
import org.doit.ik.aop.Calulator;
import org.springframework.context.support.GenericXmlApplicationContext;
public class EX03 {
public static void main(String[] args) {
//org.doit.aop2.[advice]패키지
// 전후 LogPrintAroundAdvice 클래스 추가
GenericXmlApplicationContext ctx = new GenericXmlApplicationContext("application-context3.xml");
Calulator calc = ctx.getBean("calcProxy",Calulator.class);
System.out.println(calc.add(4,2));
System.out.println("=3 END = ");
}
/*
* p 204 Charter
* 어플케이션을 다양한 공통기능이 필요로 한다
* 고유한 기능 앞에 해야될 작업들
* 공통 기능들은 어떤 특정 모듈에서만 필요로 하는 것이 안니라
* 어플리케이션 전반에 걸쳐 필요한 기능이다
* AOP 관점기능
* 중복코드필터
* AOP
* org.doit.aop 패키지 추가
* ㄴ EX01.java
* ㄴ Calulator인터페이스 추가 +-* / 추상메소드 선
* ㄴCalulatorimpl 클래스 구현
* */
}
package org.doit.ik.aop3.advice;
import java.lang.reflect.Method;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.aop.AfterReturningAdvice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
//대상객체가 핵심기능의 메서드를 예외없이 처리된 경우 호출되는 Advice
public class LogPrintAfterReturningAdvice3 implements AfterReturningAdvice{
@Override
public void afterReturning(Object returnValue, //결과값 예외없이 잘처리되는 결과값
Method method, // 메서드
Object[] args, //매개변수
Object target //대상객체
) throws Throwable {
String methodName = method.getName();
Log log= LogFactory.getLog(this.getClass());
log.info(">"+methodName+"LogPrintAfterReturningAdvice3 호출됨");
}//afterReturning
}//calss
package org.doit.ik.aop3.advice;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.StopWatch;
//보조기능을나타내는 어드바이스
@Component
public class LogPrintAroundAdvice3 implements MethodInterceptor{
// 스프링@AutowiredAOP: 메서드 호출
//calc_add() 보조기능 장착+로그기록
@Override
public Object invoke(MethodInvocation method) throws Throwable {
String methodName = method.getMethod().getName();
Log log= LogFactory.getLog(this.getClass());
log.info(">"+methodName+"()start3.");
StopWatch sw = new StopWatch();
sw.start();
// 핵심관심사항
Object result = method.proceed();//calc.add();
sw.stop();
log.info(">" + methodName + "() end3.");
log.info(">" + methodName + "() 처리 시간 : " + sw.getTotalTimeMillis() + "ms");
return result;
}
}
package org.doit.ik.aop3.advice;
import java.lang.reflect.Method;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.aop.MethodBeforeAdvice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class LogPrintBeforeAdvice3 implements MethodBeforeAdvice{
@Override
public void before(Method method // add()
, Object[] args // 4,2
, Object target // 대상객체(실제 객체 clac)
) throws Throwable {
String methodName = method.getName();
Log log= LogFactory.getLog(this.getClass());
log.info(">"+methodName+":LogPrintBeforeAdvice호출됨3..");
}//before
}//class
package org.doit.ik.AOP4;
import org.doit.ik.AOP.Calculator;
import org.springframework.stereotype.Component;
@Component("calc4")
public class CalculatorImpl4 implements Calculator{
@Override
public int add(int x, int y) {
//전 //공통 관심사항 제거
int result = x+y; //핵심 관심 사항(core concern)
//후
return result;
}
@Override
public int sub(int x, int y) {
//전
int result = x-y;//핵심 관심 사항(core concern)
//후
return result;
}
@Override
public int mult(int x, int y) {
//전
int result = x*y;//핵심 관심 사항(core concern)
//후
return result;
}
@Override
public int div(int x, int y) {
int result = x/y;//핵심 관심 사항(core concern)
return result;
}
}
package org.doit.ik.AOP4;
import org.doit.ik.AOP.Calculator;
import org.springframework.context.support.GenericXmlApplicationContext;
public class Ex04 {
public static void main(String[] args) {
/* p211 xml 설정 파일에 <aop:config>태그 이용해서
* 1)Aspect 설정
* 2)Advice+어떤 pointcut 적용할지를 설정
* */
// org.doit.il.aop2.[advice] 패키지 - 언제
//전후 LogPointAroundAdvice 클래스 추가
GenericXmlApplicationContext ctx = new GenericXmlApplicationContext
("application-context4.xml");
//Calculator calc = ctx.getBean("calc", Calculator.class);
//스프링 aop
Calculator calc = ctx.getBean("calc4", Calculator.class);
System.out.println(calc.add(4, 2));
System.out.println("= 4 END =");
} //main
}
package org.doit.ik.AOP4.advice;
import org.aopalliance.intercept.Joinpoint;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.springframework.stereotype.Component;
import org.springframework.util.StopWatch;
@Component("logPrintProfiler4")
public class LogPrintProfile4 {
//AroundAdvice p222
public Object trace(ProceedingJoinPoint joinPoint)throws
Throwable{
//BeforeAdvice
String methodName = joinPoint.getSignature().toShortString();
Log log = LogFactory.getLog(this.getClass());
log.info(methodName + "() start");
StopWatch sw = new StopWatch();
sw.start();
Object result = joinPoint.proceed();
sw.stop();
log.info(methodName + "() end.");
return result;
//AfterAdvice
}
// 2. BeforeAdvice p.217
public void before(JoinPoint joinpoint) {
String methodName = joinpoint.getSignature().toShortString();
Log log = LogFactory.getLog(this.getClass());
log.info(">>>" + methodName + "() : LogPrintProfiler4.before가 호출됨...");
}
// 3. AfterAdvice p.221
public void afterFinally(JoinPoint joinpoint) {
String methodName = joinpoint.getSignature().toShortString();
Log log = LogFactory.getLog(this.getClass());
log.info(">>>" + methodName + "() : LogPrintProfiler4.afterfinally가 호출됨...");
}
}
package org.doit.ik.AOP5;
import org.doit.ik.AOP.Calculator;
import org.springframework.stereotype.Component;
@Component("calc5")
public class CalculatorImpl5 implements Calculator{
@Override
public int add(int x, int y) {
//전 //공통 관심사항 제거
int result = x+y; //핵심 관심 사항(core concern)
//후
return result;
}
@Override
public int sub(int x, int y) {
//전
int result = x-y;//핵심 관심 사항(core concern)
//후
return result;
}
@Override
public int mult(int x, int y) {
//전
int result = x*y;//핵심 관심 사항(core concern)
//후
return result;
}
@Override
public int div(int x, int y) {
int result = x/y;//핵심 관심 사항(core concern)
return result;
}
}
package org.doit.ik.AOP5;
import org.doit.ik.AOP.Calculator;
import org.springframework.context.support.GenericXmlApplicationContext;
public class Ex05 {
public static void main(String[] args) {
/* p226 @Aspect 어노테시션 기반의 AOP구현하는 방법 */
// org.doit.il.aop2.[advice] 패키지 - 언제
//전후 LogPointAroundAdvice 클래스 추가
GenericXmlApplicationContext ctx = new GenericXmlApplicationContext
("application-context5.xml");
//Calculator calc = ctx.getBean("calc", Calculator.class);
//스프링 aop
Calculator calc = ctx.getBean("calc5", Calculator.class);
System.out.println(calc.add(4, 2));
System.out.println("= 5 END =");
} //main
}
package org.doit.ik.AOP5.advice;
import org.aopalliance.intercept.Joinpoint;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;
import org.springframework.util.StopWatch;
@Component("logPrintProfiler5")
@Aspect
public class LogPrintProfiler5 {
@Pointcut("execution(* org.doit.ik.aop..*.*(*,*))")
public void publicMethod(){}
/*
* <aop:pointcut expression="execution(*s org.doit.ik.aop..*.*(*,*))"
* id="publicMethod" />
*/
@Around("publicMethod()")
//AroundAdvice p222
public Object trace(ProceedingJoinPoint joinPoint)throws
Throwable{
//BeforeAdvice
String methodName = joinPoint.getSignature().toShortString();
Log log = LogFactory.getLog(this.getClass());
log.info(methodName + "() start");
StopWatch sw = new StopWatch();
sw.start();
Object result = joinPoint.proceed();
sw.stop();
log.info(methodName + "() end.");
return result;
//AfterAdvice
}
@Before("publicMethod()")
// 2. BeforeAdvice p.217
public void before(JoinPoint joinpoint) {
String methodName = joinpoint.getSignature().toShortString();
Log log = LogFactory.getLog(this.getClass());
log.info(">>>" + methodName + "() : LogPrintProfiler4.before가 호출됨...");
}
@After("publicMethod()")
// 3. AfterAdvice p.221
public void afterFinally(JoinPoint joinpoint) {
String methodName = joinpoint.getSignature().toShortString();
Log log = LogFactory.getLog(this.getClass());
log.info(">>>" + methodName + "() : LogPrintProfiler4.afterfinally가 호출됨...");
}
}
package org.doit.ik.mapper;
public interface SampleMapper {
String getTime();
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"https://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.doit.ik.mapper.SampleMapper">
<select id="getTime" resultType="string">
SELECT sysdate
FROM dual
</select>
</mapper>
//samplemapper.xml
<?xml version="1.0" encoding="UTF-8"?>
<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.xsd">
<bean id="calc" class="org.doit.ik.aop2.Calulatorimpl2"/>
<bean id="logPrintAroundAdvice" class="org.doit.ik.aop2.advice.LogPrintAroundAdvice" />
<bean id="logPrintBeforeAdvice" class="org.doit.ik.aop2.advice.LogPrintBeforeAdvice"/> <!-- 아이디는 명시적으로 앞글자 소문자로 -->
<bean id="logPrintAfterReturningAdvice" class="org.doit.ik.aop2.advice.LogPrintAfterReturningAdvice"></bean>
<!-- 스프링 AOP : 프록시(proxy) 기반 -->
<bean id="calcProxy" class="org.springframework.aop.framework.ProxyFactoryBean">
<!-- 1. 핵심기능하는 실제 객체 -->
<property name="target" ref="calc"></property>
<!-- 2. pointcut 설정 -->
<!-- setProxyInterfaces(Class [] 인터페이스) -->
<property name="proxyInterfaces">
<list>
<value>org.doit.ik.aop.Calulator</value>
</list>
</property>
<!-- 3. advice 등록 -->
<property name="interceptorNames">
<list>
<value>logPrintAroundAdvice</value>
<value>logPrintBeforeAdvice</value>
<value>logPrintAfterReturningAdvice</value>
</list>
</property>
</bean>
</beans>
<?xml version="1.0" encoding="UTF-8"?>
<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.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd">
<context:component-scan base-package=" org.doit.ik"/>
<!-- 스프링 AOP : 프록시(proxy) 기반 -->
<bean id="calcProxy" class="org.springframework.aop.framework.ProxyFactoryBean">
<!-- 1. 핵심기능하는 실제 객체 -->
<property name="target" ref="calc"></property>
<!-- 2. pointcut 설정 -->
<!-- setProxyInterfaces(Class [] 인터페이스) -->
<property name="proxyInterfaces">
<list>
<value>org.doit.ik.aop.Calulator</value>
</list>
</property>
<!-- 3. advice 등록 -->
<property name="interceptorNames">
<list>
<value>logPrintAroundAdvice3</value>
<value>logPrintBeforeAdvice3</value>
<value>logPrintAfterReturningAdvice3</value>
</list>
</property>
</bean>
</beans>
<?xml version="1.0" encoding="UTF-8"?>
<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"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.3.xsd">
<!-- //힘들었던 코딩 ㅃㅇ aop -->
<!-- 공통기능pointcut -->
<context:component-scan base-package="org.doit.ik"/>
<aop:config>
<aop:aspect id="traceAspect" ref="logPrintProfiler4">
<aop:pointcut expression="execution(* org.doit.ik.aop..*.*(*,*))" id="publicMethod" />
<aop:around method="trace" pointcut-ref="publicMethod" />
<aop:before method="before" pointcut-ref="publicMethod" />
<aop:after method="afterFinally" pointcut-ref="publicMethod" />
</aop:aspect>
</aop:config>
</beans>
<?xml version="1.0" encoding="UTF-8"?>
<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"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.3.xsd">
<!-- //힘들었던 코딩 ㅃㅇ aop -->
<!-- 공통기능pointcut -->
<context:component-scan base-package="org.doit.ik"/>
<aop:aspectj-autoproxy/>
</beans>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN" "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<!-- Appenders -->
<appender name="console" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p: %c - %m%n" />
</layout>
</appender>
<!-- Application Loggers -->
<logger name="org.doit.ik">
<level value="info" />
</logger>
<!-- 3rdparty Loggers -->
<logger name="org.springframework.core">
<level value="info" />
</logger>
<logger name="org.springframework.beans">
<level value="info" />
</logger>
<logger name="org.springframework.context">
<level value="info" />
</logger>
<logger name="org.springframework.web">
<level value="info" />
</logger>
<!-- Root Logger -->
<root>
<priority value="warn" />
<appender-ref ref="console" />
</root>
</log4j:configuration>
'취준 note 2023 > spring' 카테고리의 다른 글
스프링 핵심내용정리 (1) | 2023.09.28 |
---|---|
스프링 트랜젝션+pagenation (0) | 2023.08.12 |
스프링 di (0) | 2023.08.12 |
스프링 시큐리티 (0) | 2023.08.11 |
spring master - chap2 스프링빈 의존성 주입(IOC) (0) | 2023.01.23 |