상세 컨텐츠

본문 제목

pom.xml등 설정파일 긁어가깅

스프링

by e7e 2022. 4. 17. 18:45

본문

만약 긁어가서 문제가 있다면 어떨수 없음(디버깅 기회!~~)

 

구찮을 때 복사/붙여넣장!

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>kr.or</groupId>
	<artifactId>ddit</artifactId>
	<name>BasicSample</name>
	<packaging>war</packaging>
	<version>1.0.0-BUILD-SNAPSHOT</version>
	
	<!-- 요기서 부터 끝까지 복사 -->
	<properties>
		<java-version>1.8</java-version>
		<org.springframework-version>5.3.29</org.springframework-version>
		<org.aspectj-version>1.9.19</org.aspectj-version>
		<org.slf4j-version>2.0.7</org.slf4j-version>
	</properties>
	<dependencies>
		<!-- Spring -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-context</artifactId>
			<version>${org.springframework-version}</version>
			<exclusions>
				<!-- Exclude Commons Logging in favor of SLF4j -->
				<exclusion>
					<groupId>commons-logging</groupId>
					<artifactId>commons-logging</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-webmvc</artifactId>
			<version>${org.springframework-version}</version>
		</dependency>

		<!-- Aop -->
		<dependency>
			<groupId>org.aspectj</groupId>
			<artifactId>aspectjrt</artifactId>
			<version>${org.aspectj-version}</version>
		</dependency>

		<!-- Logging -->
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
			<version>${org.slf4j-version}</version>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>jcl-over-slf4j</artifactId>
			<version>${org.slf4j-version}</version>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-log4j12</artifactId>
			<version>${org.slf4j-version}</version>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>log4j</groupId>
			<artifactId>log4j</artifactId>
			<version>1.2.15</version>
			<exclusions>
				<exclusion>
					<groupId>javax.mail</groupId>
					<artifactId>mail</artifactId>
				</exclusion>
				<exclusion>
					<groupId>javax.jms</groupId>
					<artifactId>jms</artifactId>
				</exclusion>
				<exclusion>
					<groupId>com.sun.jdmk</groupId>
					<artifactId>jmxtools</artifactId>
				</exclusion>
				<exclusion>
					<groupId>com.sun.jmx</groupId>
					<artifactId>jmxri</artifactId>
				</exclusion>
			</exclusions>
			<scope>runtime</scope>
		</dependency>

		<!-- Spring  Security -->
		<dependency>
			<groupId>org.springframework.security</groupId>
			<artifactId>spring-security-config</artifactId>
			<version>5.8.6</version>
		</dependency>

		<dependency>
			<groupId>org.springframework.security</groupId>
			<artifactId>spring-security-taglibs</artifactId>
			<version>5.8.6</version>
		</dependency>


		<!-- @Inject -->
		<dependency>
			<groupId>javax.inject</groupId>
			<artifactId>javax.inject</artifactId>
			<version>1</version>
		</dependency>

		<!-- Servlet  Tomcat 9에 맞겡-->
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>javax.servlet-api</artifactId>
			<version>4.0.1</version>
			<scope>provided</scope>
		</dependency>
		<!-- JSP -->
		<dependency>
			<groupId>javax.servlet.jsp</groupId>
			<artifactId>javax.servlet.jsp-api</artifactId>
			<version>2.3.3</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>jstl</artifactId>
			<version>1.2</version>
		</dependency>

		<!-- Jackson  -->
		<dependency>
			<groupId>com.fasterxml.jackson.core</groupId>
			<artifactId>jackson-databind</artifactId>
			<version>2.15.2</version>
		</dependency>

		<!-- Lombok -->
		<dependency>
			<groupId>org.projectlombok</groupId>
			<artifactId>lombok</artifactId>
			<version>1.18.28</version>
		</dependency>
	
		<!-- 아래 HikariCP 대신 이걸 써도 됨!  
		<dependency>
		    <groupId>org.apache.commons</groupId>
		    <artifactId>commons-dbcp2</artifactId>
		    <version>2.7.0</version>
		</dependency>
		-->

		<!-- Database HikariCP -->
		<dependency>
			<groupId>com.zaxxer</groupId>
			<artifactId>HikariCP</artifactId>
			<version>4.0.3</version>
		</dependency>

		<!-- ojdbc8  문제가 한번 발생해서 주석처리 
		<dependency>
			<groupId>com.oracle.database.jdbc</groupId>
			<artifactId>ojdbc8</artifactId>
			<version>23.2.0.0</version>
		</dependency>
		-->

		<!-- ojdbc8  위에 보다 버젼 낮겡-->
		<dependency>
			<groupId>com.oracle.ojdbc</groupId>
			<artifactId>ojdbc8</artifactId>
			<version>19.3.0.0</version>
		</dependency>

		<!-- mybatis -->
		<dependency>
			<groupId>org.mybatis</groupId>
			<artifactId>mybatis</artifactId>
			<version>3.5.13</version>
		</dependency>

		<!-- mybatis-spring -->
		<dependency>
			<groupId>org.mybatis</groupId>
			<artifactId>mybatis-spring</artifactId>
			<version>2.1.1</version>
		</dependency>

		<!-- spring-jdbc -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-jdbc</artifactId>
			<version>${org.springframework-version}</version>
		</dependency>

		<!--  외부 URL 요청 라이브러리, ajax 우회용으로도 -->
		<dependency>
			<groupId>org.apache.httpcomponents.client5</groupId>
			<artifactId>httpclient5</artifactId>
			<version>5.2.1</version>
		</dependency>
		<dependency>
			<groupId>org.apache.httpcomponents.client5</groupId>
			<artifactId>httpclient5-fluent</artifactId>
			<version>5.2.1</version>
		</dependency>

		<!-- 웹소켓 라이브러링 추강 -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-websocket</artifactId>
			<version>${org.springframework-version}</version>
		</dependency>

		<!-- ftp서버에 접속하기위한 클라이언트 라이브러링 포함!! -->
		<dependency>
			<groupId>commons-net</groupId>
			<artifactId>commons-net</artifactId>
			<version>3.9.0</version>
		</dependency>

        <!--  Validation -->
		<dependency>
		    <groupId>org.hibernate</groupId>
		    <artifactId>hibernate-validator</artifactId>
		    <version>5.4.2.Final</version>
		</dependency>

		<!-- 타일즈 시작 -->
		<!-- https://mvnrepository.com/artifact/org.apache.tiles/tiles-extras -->
		<dependency>
		    <groupId>org.apache.tiles</groupId>
		    <artifactId>tiles-extras</artifactId>
		    <version>3.0.8</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/org.apache.tiles/tiles-servlet -->
		<dependency>
		    <groupId>org.apache.tiles</groupId>
		    <artifactId>tiles-servlet</artifactId>
		    <version>3.0.8</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/org.apache.tiles/tiles-jsp -->
		<dependency>
		    <groupId>org.apache.tiles</groupId>
		    <artifactId>tiles-jsp</artifactId>
		    <version>3.0.8</version>
		</dependency>

		<!-- Test  Junit5-->
		<dependency>
			<groupId>org.junit.jupiter</groupId>
			<artifactId>junit-jupiter-engine</artifactId>
			<version>5.10.0</version>
		</dependency>

		<!-- spring-test -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-test</artifactId>
			<version>5.3.29</version>
		</dependency>

	</dependencies>
	<build>
		<plugins>
			<plugin>
				<artifactId>maven-eclipse-plugin</artifactId>
				<version>2.10</version>
				<configuration>
					<additionalProjectnatures>
						<projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
					</additionalProjectnatures>
					<additionalBuildcommands>
						<buildcommand>org.springframework.ide.eclipse.core.springbuilder</buildcommand>
					</additionalBuildcommands>
					<downloadSources>true</downloadSources>
					<downloadJavadocs>true</downloadJavadocs>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.11.0</version>
				<configuration>
					<source>${java-version}</source>
					<target>${java-version}</target>
					<compilerArgument>-Xlint:all</compilerArgument>
					<showWarnings>true</showWarnings>
					<showDeprecation>true</showDeprecation>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>exec-maven-plugin</artifactId>
				<version>3.1.0</version>
				<configuration>
					<mainClass>org.test.int1.Main</mainClass>
				</configuration>
			</plugin>
		</plugins>
	</build>
</project>

 

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
         version="4.0">

	<!-- The definition of the Root Spring Container shared by all Servlets and Filters -->
	<context-param>
		<param-name>contextConfigLocation</param-name>
		<param-value>classpath:config/spring/root-context.xml</param-value>
	</context-param>
	
	<!-- Creates the Spring Container shared by all Servlets and Filters -->
	<listener>
		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
	</listener>

	<!-- Processes application requests -->
	<servlet>
		<servlet-name>appServlet</servlet-name>
		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
		<init-param>
			<param-name>contextConfigLocation</param-name>
			<param-value>classpath:config/spring/servlet-context.xml</param-value>
		</init-param>
		<!-- 404오류를 처리할 수 있도록 함 -->
		<init-param>
			<param-name>throwExceptionIfNoHandlerFound</param-name>
			<param-value>true</param-value>
		</init-param>
		<load-on-startup>1</load-on-startup>
		<!-- 파일업로드 설정 -->
		<multipart-config>
			<location>d:/temp</location>
			<max-file-size>209715200</max-file-size>
			<max-request-size>209815200</max-request-size>
			<file-size-threshold>0</file-size-threshold>
		</multipart-config>
	</servlet>
		
	<servlet-mapping>
		<servlet-name>appServlet</servlet-name>
		<url-pattern>/</url-pattern>
	</servlet-mapping>

    <!--  한글처리 인코딩 UTF-8 -->
	<filter>
          <filter-name>encodingFilter</filter-name>
          <filter-class>org.springframework.web.filter.CharacterEncodingFilter
           </filter-class>
           <init-param>
                <param-name>encoding</param-name>
                <param-value>UTF-8</param-value>
           </init-param>
           <init-param>
                <param-name>forceEncoding</param-name>
                <param-value>true</param-value>
           </init-param>
     </filter>
     <filter-mapping>
           <filter-name>encodingFilter</filter-name>
           <url-pattern>/*</url-pattern>
     </filter-mapping>

	<!-- 파일업로드에 Security 사용시 csrf 토큰처리 -->
	<filter>
		<display-name>springMultipartFilter</display-name>
		<filter-name>springMultipartFilter</filter-name>
		<filter-class>org.springframework.web.multipart.support.MultipartFilter</filter-class>
	</filter>
	<filter-mapping>
		<filter-name>springMultipartFilter</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>

    <!-- 시큐리티 필터 등록   -->
	<filter>
		<filter-name>springSecurityFilterChain</filter-name>
		<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
	</filter>
	<filter-mapping>
		<filter-name>springSecurityFilterChain</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>

<!-- 상태 코드를 사용하여 오류 페이지 설정 시작
	web.xml : tomcat서버의 설정
			  스프링 웹 프로젝트가 실행되면 가장 먼저 web.xml 파일을 읽어들이고
			  위부터 아래로 차례로 읽어들이면서 태그를 해석함
	HTTP 오류 코드
	400  : Bad Request. 문법 오류(잘못 입력한 url)
	404* : Not Found. 요청한 문서를 못찾음(url확인 및 캐시 삭제 필요)
	405  : Method not allowed. 메소드 허용 안됨(메소드 매핑이 안 될때)
	415  : 서버 요청에 대한 승인 거부(ContentType, Content Encoding 데이터 확인 필요)
	500* : 서버 내부 오류. (웹 서버가 요청사항을 수행할 수 없음. 개발자 오류)
	505  : Http Version Not Supported
	
	error-code : HTTP상태 코드
	location : 이동 대상 페이지 또는 URI
	 -->
	 <error-page>
	 	<error-code>400</error-code>
	 	<location>/error/error400</location>
	 </error-page>
	 <error-page>
	 	<error-code>404</error-code>
	 	<location>/error/error404</location>
	 </error-page>
	 <error-page>
	 	<error-code>500</error-code>
	 	<location>/error/error500</location>
	 </error-page>
	<!-- 상태 코드를 사용하여 오류 페이지 설정 끝 -->
	
	<!-- 예외 타입을 사용한 에러 페이지 설정 시작 
	웹 컨테이너(tomcat서버) 설정 파일(web.xml)의 exception-type 태그 요소에 예외 타입을 설정하고
	location 요소에 이동 대상 페이지 및 URI를 지정함
	
	IOException, SQLException, NullPointerException, ArrayIndexOutOfBoundsException,
	ArtimeticException(0으로 나눌경우)
	-->
	<error-page>
		<exception-type>java.lang.Exception</exception-type>
		<location>/error/errorException</location>
	</error-page>	
	<!-- 예외 타입을 사용한 에러 페이지 설정 끝 -->
	
	<!-- 기본 에러 페이지 설정 시작 
	웹 컨테이너(tomcat서버) 설정 파일(web.xml)의 
	-->
	<error-page>
		<location>/error/errorDefault</location>
	</error-page>
	<!-- 기본 에러 페이지 설정 끝 -->
</web-app>

root-context.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"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:tx="http://www.springframework.org/schema/tx"
	xmlns:aop="http://www.springframework.org/schema/aop"
	xsi:schemaLocation="http://www.springframework.org/schema/beans https://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
		http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.3.xsd">

	<!-- Root Context: 모든 다른 웹 컴포넌트들에게 공유되는 자원 설정 -->
	
	<!--  어노테이션 자바 설정 활성화 -->
	<context:annotation-config />
	
	<!-- 파일업로드 디렉토리 설정 -->
	<bean id="uploadPath" class="java.lang.String">
		<constructor-arg value="c:\\upload" />
	</bean>
		 
	 <!-- 스프링 AOP 활성화 -->
	 <aop:aspectj-autoproxy />
	 
	 <!-- kr.or.ddit.aop 패키지를 컴포넌트 스캔 대상으로 등록 
	 <context:component-scan base-package="aop패키지" />
	 -->
	
	
	<!-- <import resource="database-context.xml"/> -->
	<!-- <import resource="security-context.xml"/> -->
</beans>

 

database-context.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"
	xmlns:mybatis-spring="http://mybatis.org/schema/mybatis-spring"
	xmlns:tx="http://www.springframework.org/schema/tx"
	xsi:schemaLocation="http://mybatis.org/schema/mybatis-spring http://mybatis.org/schema/mybatis-spring-1.2.xsd
		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
		http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.3.xsd">

	<bean id="hikariConfig" class="com.zaxxer.hikari.HikariConfig">
		<property name="driverClassName" value="oracle.jdbc.OracleDriver" />
		<property name="jdbcUrl" value="jdbc:oracle:thin:@아이피주소:1521:XE" />
		<property name="username" value="아이디" />
		<property name="password" value="암호" />
	</bean>

	<bean id="datasource" class="com.zaxxer.hikari.HikariDataSource" destroy-method="close">
		<constructor-arg ref="hikariConfig" />
	</bean>

	<bean id="sqlSessionFactory"
		class="org.mybatis.spring.SqlSessionFactoryBean">
		<property name="dataSource" ref="datasource" />
		<property name="configLocation" value="classpath:config/mybatis/mybatis-config.xml" />
		<property name="mapperLocations" value="classpath:mapper/*-Mapper.xml" />
	</bean>

	<!-- 트랜잭션 관리자의 빈을 정의 -->
	<bean id="transactionManager"
		class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
		<property name="dataSource" ref="datasource"></property>
	</bean>	
	
	<!-- 애너테이션 기반의 트랜잭션 제어를 활성화 함 -->
	<tx:annotation-driven/>
	

	<mybatis-spring:scan base-package="맵퍼인터페이스패키지"/>
</beans>

 

servlet-context.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/mvc"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:beans="http://www.springframework.org/schema/beans"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:security="http://www.springframework.org/schema/security"
	xsi:schemaLocation="http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd
		http://www.springframework.org/schema/mvc https://www.springframework.org/schema/mvc/spring-mvc.xsd
		http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd
		http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd">

	<!-- DispatcherServlet Context: defines this servlet's request-processing infrastructure -->
	
	<!-- Enables the Spring MVC @Controller programming model -->
	<annotation-driven />

	<!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources directory -->
	<resources mapping="/resources/**" location="/resources/" />
	<!-- 외부 파일 맵핑         웹경로                                     물리적경로                 -->
	<resources mapping="/myfiles/**" location="file:d:/uploads/" />
	<!--                                                                  -->

	<!-- Resolves views selected for rendering by @Controllers to .jsp resources in the /WEB-INF/views directory -->
	<!-- setOrder("2") => tiles를 작동한 후에 ViewResolver를 작동하겠다라는 의미 -->
	<beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
		<beans:property name="prefix" value="/WEB-INF/views/" />
		<beans:property name="suffix" value=".jsp" />
		<beans:property name="order" value="2" />
	</beans:bean>
	
	<!-- Tiles 설정 시작 -->
	<beans:bean id="tilesConfigurer"
		class="org.springframework.web.servlet.view.tiles3.TilesConfigurer">
		<beans:property name="definitions">
			<beans:list>
				<beans:value>/WEB-INF/tiles/tiles-config.xml</beans:value>
			</beans:list>
		</beans:property>
	</beans:bean>
	<!-- UrlBasedViewResolver tilesViewResolver = new UrlBasedViewResolver() -->
	<beans:bean id="tilesViewResolver"
		class="org.springframework.web.servlet.view.UrlBasedViewResolver">
		<beans:property name="viewClass"
			value="org.springframework.web.servlet.view.tiles3.TilesView" />
		<beans:property name="order" value="1" />
	</beans:bean>
	<!-- Tiles 설정 끝 -->
	
	<!--  요걸 등록해야 실제 파일업로드를 사용할 수 있음 -->
	<beans:bean id="multipartResolver" class="org.springframework.web.multipart.support.StandardServletMultipartResolver" />
	
	<security:global-method-security pre-post-annotations="enabled" secured-annotations="enabled" />
	<context:component-scan base-package="패키지" />
	<!--  root-context에 import하면 다른 컴포넌트 autowired 할때 순서가 꼬임 -->
<!-- 	<beans:import resource="websocket-context.xml"/>	 -->
		
</beans:beans>

 

security-context.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"
	xmlns:security="http://www.springframework.org/schema/security"
	xsi:schemaLocation="http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-5.8.xsd
		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
	
	<bean id="bCryptPasswordEncoder"  class="org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder"/>
	<bean id="customUserDetailsService"   class="com.minu.sec.security.CustomUserDetailsService"/>
	<bean id="customAccessDeniedHandler"   class="com.minu.sec.security.CustomAccessDeniedHandler"/>
	<bean id="customLoginSuccessHandler" class="com.minu.sec.security.CustomLoginSuccessHandler"/>
	
	<security:http>
		<!-- 요거이 없으면 추측해야 해서 힘듬  -->
		<security:access-denied-handler ref="customAccessDeniedHandler"/>
		<security:intercept-url pattern="/oho/all" access="permitAll" />
		<security:intercept-url pattern="/oho/sukil" access="hasRole('ROLE_SUKIL')" />
		<!-- 사용자가 입력한 URL로 그대로 가게 둘때는 꼭 필요하진 않지만
			 로그인 성공후에 특정 URL로 보내고 싶을 때는 success-handler가 필용!
		-->
		<security:form-login  authentication-success-handler-ref="customLoginSuccessHandler"  login-page="/login"  login-processing-url="/login"/>
		<security:logout logout-url="/logout" />
	</security:http>

	<security:authentication-manager id="authMgr">
		<security:authentication-provider  user-service-ref="customUserDetailsService">
			<security:password-encoder ref="bCryptPasswordEncoder" />
		</security:authentication-provider>
	</security:authentication-manager>

</beans>

 

websocket-context.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"
	xmlns:websocket="http://www.springframework.org/schema/websocket"
	xsi:schemaLocation="http://www.springframework.org/schema/websocket http://www.springframework.org/schema/websocket/spring-websocket-4.3.xsd
		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

	<bean id="chatHandler"  class="com.minu.merong.handler.ChatHandler" />
	<websocket:handlers allowed-origins="*">
		<websocket:mapping handler="chatHandler" path="/ws-chat" />
		<websocket:handshake-interceptors>
			<bean class="org.springframework.web.socket.server.support.HttpSessionHandshakeInterceptor" />
		</websocket:handshake-interceptors>
	</websocket:handlers>

</beans>

 

mybatis-config.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd" >
<configuration>
	<settings>
		<setting name="mapUnderscoreToCamelCase" value="true"/>
		<setting name="jdbcTypeForNull" value="VARCHAR"/>
	</settings>
	<typeAliases>
		<package name="앨리어스할 패키지"/>
	</typeAliases>
</configuration>

 

tiles-config.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE tiles-definitions PUBLIC 
"-//Apache Software Foundation//DTD Tiles Configuration 3.0//EN" 
"http://tiles.apache.org/dtds/tiles-config_3_0.dtd">
<!-- tiles 설정 -->
<tiles-definitions>
	<!-- main layout -->
	<definition name="tiles-layout" template="/WEB-INF/views/tiles/index.jsp">
		<put-attribute name="header" value="/WEB-INF/views/tiles/header.jsp" />
		<put-attribute name="aside" value="/WEB-INF/views/tiles/aside.jsp" />
		<put-attribute name="body" value="" />
		<put-attribute name="footer" value="/WEB-INF/views/tiles/footer.jsp" />
	</definition>
	<!-- name의 */*은 body의 value에서 1과 2에 해당
		controller에서 forwarding 시 return "1/2";
		
		return "shopping/products"
		만약.. "/shopping/products"
	 -->
	<definition name="*/*" extends="tiles-layout">
		<put-attribute name="body" value="/WEB-INF/views/{1}/{2}.jsp" />
	</definition>
</tiles-definitions>

'스프링' 카테고리의 다른 글

초간단 WebSocket 채팅  (16) 2022.04.28
MVC이해  (0) 2022.04.27
HttpClient  (5) 2022.04.27
SQL로그 출력  (0) 2022.04.17
MyBatis(마이바티스) 설정  (0) 2022.04.10

관련글 더보기