diff --git a/others/how_to_use.txt b/others/how_to_use.txt index 242a45d..0d587ab 100644 --- a/others/how_to_use.txt +++ b/others/how_to_use.txt @@ -15,9 +15,10 @@ 4.修改application.properties(位于src/resources目录)中的数据库连接信息(包括username, password等) -5.将本地项目导入到IDE(如Intellij IDEA)中,配置Tomcat(或类似的servlet运行服务器), 并启动Tomcat(默认端口为8080) +5.将本地项目导入到IDE(如Intellij IDEA)中,可直接run SpringOauthServerApplication.java(默认端口为8080) 另: 也可通过maven package命令将项目编译为war文件(spring-oauth-server.war), - 将war放在Tomcat中并启动(注意: 这种方式需要将application.properties加入到classpath中并正确配置数据库连接信息). + 将war放在Tomcat中并启动(注意: 这种方式需要将application.properties加入到classpath中并正确配置数据库连接信息) + 或使用命令 java -jar spring-oauth-server.war 6.参考oauth_test.txt(位于others目录)的内容并测试之(也可在浏览器中访问相应的地址,如: http://localhost:8080/spring-oauth-server). diff --git a/src/main/java/com/monkeyk/sos/SpringOauthServerApplication.java b/src/main/java/com/monkeyk/sos/SpringOauthServerApplication.java index a954c9c..5fb6d34 100644 --- a/src/main/java/com/monkeyk/sos/SpringOauthServerApplication.java +++ b/src/main/java/com/monkeyk/sos/SpringOauthServerApplication.java @@ -13,7 +13,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; public class SpringOauthServerApplication { /** - * 不能直接运行 main + * 直接运行 main * 详细 请参考 others/how_to_use.txt 文件 * * @param args args diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index f5e51d2..453af41 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -22,6 +22,9 @@ spring.mvc.ignore-default-model-on-redirect=false spring.mvc.view.prefix=/WEB-INF/jsp/ spring.mvc.view.suffix=.jsp # +server.servlet.context-path=${spring.application.name} +# +server.port=8080 # # Logging # diff --git a/src/test/resources/application-test.properties b/src/test/resources/application-test.properties index 79bdbe8..6df4c75 100644 --- a/src/test/resources/application-test.properties +++ b/src/test/resources/application-test.properties @@ -13,6 +13,10 @@ spring.datasource.type=com.zaxxer.hikari.HikariDataSource spring.datasource.hikari.maximum-pool-size=20 #spring.datasource.hikari.minimum-idle=2 # +server.servlet.context-path=${spring.application.name} +# +server.port=8080 +# # MVC spring.mvc.ignore-default-model-on-redirect=false #spring.http.encoding.enabled=true