diff --git a/springboot-web/.settings/org.eclipse.core.resources.prefs b/springboot-web/.settings/org.eclipse.core.resources.prefs index 4c28b1a..04cfa2c 100644 --- a/springboot-web/.settings/org.eclipse.core.resources.prefs +++ b/springboot-web/.settings/org.eclipse.core.resources.prefs @@ -1,4 +1,6 @@ eclipse.preferences.version=1 encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 encoding//src/test/java=UTF-8 +encoding//src/test/resources=UTF-8 encoding/=UTF-8 diff --git a/springboot-web/.settings/org.eclipse.jdt.core.prefs b/springboot-web/.settings/org.eclipse.jdt.core.prefs index 8626026..cbb750c 100644 --- a/springboot-web/.settings/org.eclipse.jdt.core.prefs +++ b/springboot-web/.settings/org.eclipse.jdt.core.prefs @@ -1,5 +1,12 @@ eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning org.eclipse.jdt.core.compiler.source=1.5 diff --git a/springboot-web/pom.xml b/springboot-web/pom.xml index 3a6c31d..843a005 100644 --- a/springboot-web/pom.xml +++ b/springboot-web/pom.xml @@ -38,6 +38,10 @@ + + org.springframework.boot + spring-boot-starter-freemarker + org.springframework.boot spring-boot-starter-log4j2 @@ -61,10 +65,7 @@ log4j-slf4j-impl ${log4j2.version} - - org.springframework.boot - spring-boot-starter-thymeleaf - + org.springframework.boot spring-boot-devtools @@ -118,6 +119,7 @@ jquery 1.11.3 + diff --git a/springboot-web/src/main/java/com/smart/web/Application.java b/springboot-web/src/main/java/com/smart/web/Application.java index 46c7471..fa527a5 100644 --- a/springboot-web/src/main/java/com/smart/web/Application.java +++ b/springboot-web/src/main/java/com/smart/web/Application.java @@ -1,7 +1,11 @@ package com.smart.web; +import java.io.IOException; + import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer; +import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer; import org.springframework.context.annotation.ImportResource; /** * 程序主入口 @@ -11,15 +15,20 @@ */ @SpringBootApplication @ImportResource({"classpath:ApplicationContext.xml", "classpath:ApplicationContext-mvc.xml"}) -public class Application { +public class Application implements EmbeddedServletContainerCustomizer { + + private static int port = 8083; public static void main(String[] args) { SpringApplication.run(Application.class, args); + String cmd = "rundll32 url.dll,FileProtocolHandler http://localhost:" + port +"/login"; + try { + Runtime.getRuntime().exec(cmd); + } catch (IOException e) { + } + + } + + public void customize(ConfigurableEmbeddedServletContainer container) { + container.setPort(port); } - - /*@Bean - public ServletRegistrationBean dispatcherRegistration(DispatcherServlet dispatcherServlet) { - ServletRegistrationBean registration = new ServletRegistrationBean(dispatcherServlet); - //registration.addUrlMappings("*.do"); - return registration; - }*/ } diff --git a/springboot-web/src/main/java/com/smart/web/frame/controller/LoginController.java b/springboot-web/src/main/java/com/smart/web/frame/controller/LoginController.java index 6f62f9e..414fae1 100644 --- a/springboot-web/src/main/java/com/smart/web/frame/controller/LoginController.java +++ b/springboot-web/src/main/java/com/smart/web/frame/controller/LoginController.java @@ -2,6 +2,7 @@ import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; @@ -22,7 +23,7 @@ public ModelAndView login () { mv.setViewName("login"); return mv; } - @RequestMapping(value = "/sysadmin") + @RequestMapping(value = "/sysadmin", method = RequestMethod.POST) @ResponseBody public Object test () { return "ssss"; diff --git a/springboot-web/src/main/resources/application.properties b/springboot-web/src/main/resources/application.properties index 464a469..1834e0b 100644 --- a/springboot-web/src/main/resources/application.properties +++ b/springboot-web/src/main/resources/application.properties @@ -62,30 +62,30 @@ server.tomcat.uri-encoding = UTF8 #spring.resources.add-mappings=true # if default mappings should be added # THYMELEAF (ThymeleafAutoConfiguration) -spring.thymeleaf.prefix=classpath:/templates/ -spring.thymeleaf.suffix=.html -spring.thymeleaf.mode=HTML5 -spring.thymeleaf.encoding=UTF-8 +#spring.thymeleaf.prefix=classpath:/templates/ +#spring.thymeleaf.suffix=.html +#spring.thymeleaf.mode=HTML5 +#spring.thymeleaf.encoding=UTF-8 # ;charset= is added -spring.thymeleaf.content-type=text/html +#spring.thymeleaf.content-type=text/html # set to false for hot refresh -spring.thymeleaf.cache=true +#spring.thymeleaf.cache=true # FREEMARKER (FreeMarkerAutoConfiguration) -#spring.freemarker.allowRequestOverride=false -#spring.freemarker.allowSessionOverride=false -#spring.freemarker.cache=true -#spring.freemarker.checkTemplateLocation=true -#spring.freemarker.contentType=text/html -#spring.freemarker.exposeRequestAttributes=false -#spring.freemarker.exposeSessionAttributes=false -#spring.freemarker.exposeSpringMacroHelpers=false +spring.freemarker.allowRequestOverride=false +spring.freemarker.allowSessionOverride=false +spring.freemarker.cache=true +spring.freemarker.checkTemplateLocation=true +spring.freemarker.contentType=text/html +spring.freemarker.exposeRequestAttributes=false +spring.freemarker.exposeSessionAttributes=false +spring.freemarker.exposeSpringMacroHelpers=false #spring.freemarker.prefix= #spring.freemarker.requestContextAttribute= #spring.freemarker.settings.*= -#spring.freemarker.suffix=.ftl -#spring.freemarker.templateEncoding=UTF-8 -#spring.freemarker.templateLoaderPath=classpath:/templates/ +spring.freemarker.suffix=.html +spring.freemarker.templateEncoding=UTF-8 +spring.freemarker.templateLoaderPath=classpath:/templates/ #spring.freemarker.viewNames= # whitelist of view names that can be resolved # ## GROOVY TEMPLATES (GroovyTemplateAutoConfiguration) diff --git a/springboot-web/src/main/resources/templates/error.html b/springboot-web/src/main/resources/templates/error.html new file mode 100644 index 0000000..77c7abf --- /dev/null +++ b/springboot-web/src/main/resources/templates/error.html @@ -0,0 +1,45 @@ + + + + + + + + + + + + H+ 后台主题UI框架 - 404 页面 + + + + + + + + + + + + + +
+

404

+

页面未找到!

+ +
+ 抱歉,页面好像去火星了~ [${exception}] +
+
+ +
+ +
+
+
+ + + + + +