Idea不能使用JSP問題解決&開發工具之配置檔案
阿新 • • 發佈:2018-12-21
1.編寫application.yml配置檔案
#SpringBoot啟動埠和專案路徑 server: port: 8080 context-path: / #SpringMVC中JSP檢視配置 spring: mvc: view: prefix: /WEB-INF/views/ suffix: .jsp #資料來源配置 datasource: name: w1 url: jdbc:mysql://127.0.0.1:3306/ssm?useUnicode=true&characterEncoding=utf8 username: root password: root type: com.alibaba.druid.pool.DruidDataSource driver-class-name: com.mysql.jdbc.Driver maxActive: 20 initialSize: 1 maxWait: 60000 minIdle: 1 #Http編碼配置 http: encoding: force: true charset: UTF-8 enabled: true #Rabbitmq訊息伺服器配置 rabbitmq: host: 127.0.0.1 port: 5672 username: guest password: guest virtual-host: / # Redis資料庫索引(預設為0) redis: database: 0 host: 192.168.232.128 port: 6379 password: redis pool.max-active: 8 pool.max-wait: -1 pool.max-idle: 8 pool.min-idle: 0 timeout: 0 #Solr配置 data: solr: host: http://localhost:8984/solr/new_core #Mybatis實體類配置 mybatis: mapper-locations: classpath:mapper/*.xml #pagehelper分頁外掛 pagehelper: helperDialect: mysql reasonable: true #日誌配置 logging: file: d:/springboot.log level: com.test.mapper: DEBUG
2.在pom.xml中加入以下依賴
<dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>jstl</artifactId> </dependency> <dependency> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-jasper</artifactId> </dependency> <dependency> <groupId>org.apache.tomcat</groupId> <artifactId>tomcat-jsp-api</artifactId> </dependency> <!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind --> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>2.7.5</version> </dependency>