Notice
Recent Posts
Recent Comments
Link
«   2025/07   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
Archives
Today
Total
관리 메뉴

JAVA Developer Training

JAVA spring 세팅 본문

환경설정 , 기타 설치

JAVA spring 세팅

Romenest 2021. 9. 6. 17:08

1. boot. pom.xml dependencies 설정

<dependencies>
	 

		<!-- web 개발 -->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
		</dependency>

		<!-- devtools 이게있어야 코드변경마다 서버를 자동으로 갱신  tomcat 자동 구동-->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-devtools</artifactId>
			<scope>runtime</scope>
			<optional>true</optional>
		</dependency>

		<!-- lombok -->
		<dependency>
			<groupId>org.projectlombok</groupId>
			<artifactId>lombok</artifactId>
			<optional>true</optional>
		</dependency>

		<!-- 웹서버 WAS 톰캣 , nginx , apache -->
		<dependency>
			<groupId>org.apache.tomcat.embed</groupId>
			<artifactId>tomcat-embed-jasper</artifactId>
			<scope>provided</scope>
		</dependency>

		<!-- mongodb 연동 -->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-data-mongodb</artifactId>
		</dependency>

		<!-- junit 단위test -->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
		</dependency>

		<!-- jstl -->
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>jstl</artifactId>
		</dependency>

	</dependencies>

2. application.properties 설정

# 주석문


server.port = 8080

#view에 해당하는 jsp의 위치와 확장자
spring.mvc.view.prefix=/WEB-INF/Views/
spring.mvc.view.suffix=.jsp

#서버자동 시작
spring.devtools.livereload.enabled=true

spring.data.mongodb.uri=mongodb://id318:pw318@1.234.5.158:37017/id318
spring.data.mongodb.database=id318
spring.jpa.hibernate.ddl-auto=update

3. Boot20210903Application 설정

package com.example.boot_20210903;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;

@EnableAutoConfiguration(exclude = { DataSourceAutoConfiguration.class })
@SpringBootApplication
@ComponentScan(basePackages = { "com.example.controller" })
@EntityScan(basePackages = { "com.example.entity" })
@EnableMongoRepositories(basePackages = { "com.example.repository" })

public class Boot20210903Application {

	public static void main(String[] args) {
		SpringApplication.run(Boot20210903Application.class, args);
		System.out.println("Hello world");
	}

}

 

 

'환경설정 , 기타 설치' 카테고리의 다른 글

가상 DB설치 h2-console  (0) 2021.09.29
socket.io 를 이용한 실시간 채팅 준비  (0) 2021.09.08
eclipse 부가 기능 설치  (0) 2021.08.30
Eclipse ERmaster 설치  (0) 2021.08.27
dependencies 기능 추가  (0) 2021.08.27