DI 확인
This commit is contained in:
20
boot_gradle_security/bin/main/application.yml
Normal file
20
boot_gradle_security/bin/main/application.yml
Normal file
@@ -0,0 +1,20 @@
|
||||
spring:
|
||||
mvc:
|
||||
view:
|
||||
prefix: /WEB-INF/jsp/
|
||||
suffix: .jsp
|
||||
|
||||
datasource:
|
||||
# driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
|
||||
driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
# url: jdbc:sqlserver://192.168.0.31:1433;instanceName=BSHOP_DATA
|
||||
url: jdbc:log4jdbc:sqlserver://192.168.0.31:1433;instanceName=BSHOP_DATA
|
||||
username: jayhyub7
|
||||
password: dkagh1234.
|
||||
|
||||
# jsp파일 reload할때마다 재부팅해야되서 해당설정 추가해주었음.
|
||||
server:
|
||||
servlet:
|
||||
jsp:
|
||||
init-parameters:
|
||||
development: true
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
4
boot_gradle_security/bin/main/log4jdbc.log4j2.properties
Normal file
4
boot_gradle_security/bin/main/log4jdbc.log4j2.properties
Normal file
@@ -0,0 +1,4 @@
|
||||
# maxlinelength is decide the number of line
|
||||
# 0 is noLimit , no Option is Just one line
|
||||
log4jdbc.spylogdelegator.name=net.sf.log4jdbc.log.slf4j.Slf4jSpyLogDelegator
|
||||
log4jdbc.dump.sql.maxlinelength=0
|
||||
30
boot_gradle_security/bin/main/logback.xml
Normal file
30
boot_gradle_security/bin/main/logback.xml
Normal file
@@ -0,0 +1,30 @@
|
||||
<configuration>
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>%d{yyyyMMdd HH:mm:ss.SSS} [%thread] %-3level %logger{5} - %msg %n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<logger name="jdbc" level="OFF"/>
|
||||
|
||||
<logger name="jdbc.sqlonly" level="OFF"/>
|
||||
<logger name="jdbc.sqltiming" level="DEBUG"/>
|
||||
<logger name="jdbc.audit" level="OFF"/>
|
||||
<logger name="jdbc.resultset" level="OFF"/>
|
||||
<logger name="jdbc.resultsettable" level="DEBUG"/>
|
||||
<logger name="jdbc.connection" level="OFF"/>
|
||||
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT" />
|
||||
</root>
|
||||
|
||||
<!--
|
||||
- jdbc.sqlonly : SQL문만을 로그로 남기며, PreparedStatement일 경우 관련된 argument 값으로 대체된 SQL문이 보여진다.
|
||||
- jdbc.sqltiming : SQL문과 해당 SQL을 실행시키는데 수행된 시간 정보(milliseconds)를 포함한다.
|
||||
- jdbc.audit : ResultSet을 제외한 모든 JDBC 호출 정보를 로그로 남긴다. 많은 양의 로그가 생성되므로 특별히 JDBC 문제를 추적해야 할 필요가 있는 경우를 제외하고는 사용을 권장하지 않는다.
|
||||
- jdbc.resultset : ResultSet을 포함한 모든 JDBC 호출 정보를 로그로 남기므로 매우 방대한 양의 로그가 생성된다.
|
||||
- jdbc.resultsettable : SQL 결과 조회된 데이터의 table을 로그로 남긴다.
|
||||
-->
|
||||
|
||||
|
||||
</configuration>
|
||||
20
boot_gradle_security/src/main/resources/application.yml
Normal file
20
boot_gradle_security/src/main/resources/application.yml
Normal file
@@ -0,0 +1,20 @@
|
||||
spring:
|
||||
mvc:
|
||||
view:
|
||||
prefix: /WEB-INF/jsp/
|
||||
suffix: .jsp
|
||||
|
||||
datasource:
|
||||
# driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
|
||||
driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
# url: jdbc:sqlserver://192.168.0.31:1433;instanceName=BSHOP_DATA
|
||||
url: jdbc:log4jdbc:sqlserver://192.168.0.31:1433;instanceName=BSHOP_DATA
|
||||
username: jayhyub7
|
||||
password: dkagh1234.
|
||||
|
||||
# jsp파일 reload할때마다 재부팅해야되서 해당설정 추가해주었음.
|
||||
server:
|
||||
servlet:
|
||||
jsp:
|
||||
init-parameters:
|
||||
development: true
|
||||
2
copyCmd
Normal file
2
copyCmd
Normal file
@@ -0,0 +1,2 @@
|
||||
cp -r /c/dev/workspace_STS/boot_gradle_security/ /c/dev/gitDir/Spring
|
||||
|
||||
@@ -11,7 +11,6 @@ public class Program {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
Exam exam = new NewlecExam();
|
||||
//ExamConsole console = new InlineExamConsole(exam); // DI
|
||||
//ExamConsole console = new GridExamConsole(exam);
|
||||
|
||||
@@ -32,8 +31,6 @@ public class Program {
|
||||
|
||||
//ExamConsole console = (ExamConsole)context.getBean("console");
|
||||
ExamConsole console = context.getBean(ExamConsole.class);
|
||||
console.setExam(exam);
|
||||
|
||||
|
||||
console.print();
|
||||
|
||||
|
||||
@@ -1,22 +1,19 @@
|
||||
package spring.di;
|
||||
|
||||
import spring.di.entity.CableMouse;
|
||||
import spring.di.entity.Mouse;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
import spring.di.ui.Computer;
|
||||
|
||||
public class Student {
|
||||
|
||||
public static void main(String[] args) {
|
||||
ApplicationContext context =
|
||||
new ClassPathXmlApplicationContext("spring/di/setting2.xml");
|
||||
|
||||
//Computer computer= context.getBean(Computer.class);
|
||||
Computer computer = (Computer)context.getBean("computer");
|
||||
|
||||
Computer computer = new Computer();
|
||||
|
||||
Mouse mouse = new CableMouse(); // 유선마우스
|
||||
//Mouse mouse = new WireLessMouse(); // 무선마우스
|
||||
|
||||
// 작업을 위한 준비. 마우스 연결
|
||||
computer.connectMouse(mouse);
|
||||
// 연결확인
|
||||
computer.mouseCheck();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,13 +4,12 @@
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
|
||||
<!-- Exam exam = new NewlecExam(); -->
|
||||
<bean id ="exam" class="spring.di.entity.NewlecExam" />
|
||||
<bean id="exam" class="spring.di.entity.NewlecExam" />
|
||||
|
||||
<!-- ExamConsole console = new GridExamConsole(); -->
|
||||
<bean id ="console" class ="spring.di.ui.InlineExamConsole" >
|
||||
<!-- ExamConsole console = new GridExamConsole(); -->
|
||||
<bean id="console" class="spring.di.ui.InlineExamConsole">
|
||||
<!-- console.setExam(exam); -->
|
||||
<property name ="exam" ref="exam" />
|
||||
<property name="exam" ref="exam" />
|
||||
</bean>
|
||||
|
||||
|
||||
</beans>
|
||||
|
||||
14
spring/di/setting2.xml
Normal file
14
spring/di/setting2.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?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="cableMouse" class="spring.di.entity.CableMouse" />
|
||||
<bean id="wireLessMouse" class="spring.di.entity.WireLessMouse" />
|
||||
|
||||
<bean id="computer" class="spring.di.ui.Computer">
|
||||
<property name="mouse" ref="cableMouse" />
|
||||
<!-- <property name="mouse" ref="wireLessMouse" /> 무선마우스-->
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
@@ -5,10 +5,10 @@ import spring.di.entity.Mouse;
|
||||
public class Computer {
|
||||
private Mouse mouse ;
|
||||
|
||||
public void connectMouse(Mouse mouse) {
|
||||
this.mouse=mouse;
|
||||
};
|
||||
public void mouseCheck() {
|
||||
mouse.mouseCheck();
|
||||
};
|
||||
public void setMouse(Mouse mouse) {
|
||||
this.mouse=mouse;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user