Spring framework
[스프링] application.properties란?
꽉 쥔 주먹속에 안경닦이
2023. 4. 9. 11:16
728x90
application.properties?
web.xml은 Servlet 2.5 버전 이전에 사용되던 web 애플리케이션의 배포 서술자(descriptor) 파일입니다.
하지만 Servlet 3.0부터는 web.xml 대신 자바 기반의 설정(Configuration) 클래스를 사용할 수 있게 되었고,
이후 Spring Boot에서는 web.xml 대신 application.properties 또는 application.yml 파일을 사용하도록 권장하고 있습니다.
application.properties는 스프링 부트에서 사용되는 설정 파일 중 하나로, 애플리케이션에 필요한 여러 가지 속성을 정의할 수 있습니다. 예를 들어, 데이터베이스 연결 정보, 포트 번호, 로깅 설정 등을 application.properties 파일에서 정의할 수 있습니다.
데이터베이스 연결 예시
spring.datasource.url=jdbc:mysql://localhost:3306/mydb
spring.datasource.username=root
spring.datasource.password=password
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
디버그 로깅레벨
logging.level.com.example=DEBUG
html 연결
spring.thymeleaf.prefix=classpath:templates/
spring.thymeleaf.check-template-location=true
spring.thymeleaf.suffix=.html
spring.thymeleaf.mode=HTML5
spring.thymeleaf.cache=false
spring.thymeleaf.order=0
*index.html 파일은
src/main/resources/template 디렉토리에 위치해야 합니다.
포트번호
server.port=8080
spring.security
spring.security.user.name=test
spring.security.user.password=****
728x90