1. Properties 설정

1
spring.freemarker.request-context-attribute: rc
cs

 

 

2. Template에서 사용

1
${rc.getContextPath()}
cs

 

 

 

 

 

Posted by 셋부터넷
,

1. 의존성 추가

- Maven

1
2
3
4
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-freemarker</artifactId>
</dependency>
cs

- Gradle

1
compile('org.springframework.boot:spring-boot-starter-freemarker')
cs

 

 

2. Properties 설정

1
2
3
4
5
6
7
8
9
10
#freemarker configs
spring.freemarker.template-loader-path=classpath:/templates
spring.freemarker.prefix=/freemarker/
spring.freemarker.suffix=.ftl
spring.freemarker.contentType=text/html
spring.freemarker.charset=UTF-8
spring.freemarker.cache=false
 
#devtools configs
spring.devtools.livereload.enabled=true
cs

※ livereload를 enable시 freemarker cache 옵션을 false로 변경하여 ftl이 변경시 자동으로 새로고침되도록 설정하며 운영시에는 반드시 cache옵션을 true로 변경

 


3. Controller 작성

1
2
3
4
5
@GetMapping("/hello")
public String hello(Map model){
    model.put("msg""hello freemarker");
    return "hello";
}
cs

 


4. Test Template 작성

1
2
3
4
5
6
7
8
9
10
11
<!DOCTYPE html>
<html lang="ko">
<head>
    <meta charset="utf-8">
    <title>hello</title>
</head>
<body>
    <h1>Freemarker Test</h1>
    <h2>${msg}</h2>
</body>
</html>
cs

 

 

Posted by 셋부터넷
,

[ 에러 사항 ]

- 증상 1번

# 일반 사용자로 접속시 에러 발생

$ sqlplus ID/PW@SID

 

SQL*Plus: Release 11.2.0.1.0 Production on Fri Jul 11 15:12:50 2014

 

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

 

ERROR:

ORA-12514: TNS:listener does not currently know of service requested in connect descriptor

 

- 증상 2번

$ 인스턴스 실행 시 아래와 같은 에러 발생

$ sqlplus /nolog

 

SQL*Plus: Release 11.2.0.1.0 Production on Fri Jul 11 15:41:55 2014

 

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

 

SQL> connect orcl as sysdba

Enter password: 

Connected to an idle instance.

SQL> startup

ORA-00845: MEMORY_TARGET not supported on this system

 

 

[ 원인 ]

오라클 11g에서 사용하는 AMM(automatic memory management)의 할당 메모리가 적다(memory_max_target,memory_target)

아래 명령어로 확인 시 결과가 나와야한다. 

SQL> show parameter memory

 

[ 해결방법 ]

- 확인 -

#df로 확인 시 /dev/shm할당 메모리를 확인한다. 가용 메모리가 충분한데도 에러가 발생한다.

# df -h

tmpfs                  32G   12G   21G  36% /dev/shm

 

- 조치 -

# 실제 메모리에 등록될 데이터 용량이 더 많은것이다. 충분히 늘려준다.

# mount -t tmpfs shmfs -o size=48g,remount /dev/shm

 

- 인스턴스 실행 -

$ sqlplus /nolog
SQL> connect orcl as sysdba

Enter password: 

Connected to an idle instance.

SQL> startup

ORACLE instance started.

 

Total System Global Area 2.6991E+10 bytes

Fixed Size                  2213976 bytes

Variable Size            2.5501E+10 bytes

Database Buffers         1342177280 bytes

Redo Buffers              145174528 bytes

Database mounted.

Database opened.

SQL> show parameter memory

 

NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

hi_shared_memory_address             integer     0

memory_max_target                    big integer 25856M

memory_target                        big integer 25856M

shared_memory_address                integer     0

SQL>

 

# df -h

tmpfs                  48G   21G   28G  43% /dev/shm

 

출처 : egloos.zum.com/repository/v/5812005

Posted by 셋부터넷
,