This commit is contained in:
shimingxy
2019-09-20 00:09:08 +08:00
parent 7792e31dfa
commit 31d2e69018
72 changed files with 2062 additions and 1101 deletions

View File

@@ -1,26 +1,56 @@
package org.maxkey;
import java.util.Date;
import javax.servlet.ServletException;
import org.maxkey.web.InitApplicationContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ImportResource;
@SpringBootApplication
@ImportResource(locations={"classpath:spring/maxkey-mgt.xml"})
@ComponentScan(basePackages = {
"org.maxkey.MaxKeyConfig"
"org.maxkey.MaxKeyMgtConfig"
}
)
public class MaxKeyMgtApplication extends SpringBootServletInitializer {
private static final Logger _logger = LoggerFactory.getLogger(MaxKeyMgtApplication.class);
@Bean
MaxKeyMgtConfig MaxKeyMgtConfig() {
return new MaxKeyMgtConfig();
}
public static void main(String[] args) {
SpringApplication.run(MaxKeyMgtApplication.class, args);
ConfigurableApplicationContext applicationContext =SpringApplication.run(MaxKeyMgtApplication.class, args);
InitApplicationContext initWebContext=new InitApplicationContext(applicationContext);
try {
initWebContext.init(null);
} catch (ServletException e) {
e.printStackTrace();
_logger.error("",e);
}
_logger.info("MaxKeyMgt at "+new Date(applicationContext.getStartupDate()));
_logger.info("MaxKeyMgt Server Port "+applicationContext.getBean(MaxKeyMgtConfig.class).getPort());
_logger.info("MaxKeyMgt started.");
}
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(MaxKeyMgtApplication.class);
}

View File

@@ -1,10 +1,22 @@
package org.maxkey;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
@Configuration
@Component
@PropertySource("classpath:/application.properties")
public class MaxKeyMgtConfig {
@Value("${server.port:8080}")
private int port;
public int getPort() {
return port;
}
public void setPort(int port) {
this.port = port;
}
}

View File

@@ -43,7 +43,7 @@ public class AccountsController {
@RequestMapping(value={"/list"})
public ModelAndView appAccountsList(){
ModelAndView modelAndView=new ModelAndView("app/accounts/list");
ModelAndView modelAndView=new ModelAndView("/accounts/appAccountsList");
return modelAndView;
}
@@ -56,14 +56,14 @@ public class AccountsController {
@RequestMapping(value = { "/forwardSelect/{appId}" })
public ModelAndView forwardSelect(@PathVariable("appId") String appId) {
ModelAndView modelAndView=new ModelAndView("app/accounts/appAccountsAddSelect");
ModelAndView modelAndView=new ModelAndView("/accounts/appAccountsAddSelect");
modelAndView.addObject("appId",appId);
return modelAndView;
}
@RequestMapping(value = { "/forwardAdd" })
public ModelAndView forwardAdd(@ModelAttribute("appAccounts") Accounts appAccounts) {
ModelAndView modelAndView=new ModelAndView("app/accounts/appAccountsAdd");
ModelAndView modelAndView=new ModelAndView("/accounts/appAccountsAdd");
Applications app= applicationsService.get(appAccounts.getAppId());
appAccounts.setAppName(app.getName());
modelAndView.addObject("model",appAccounts);
@@ -88,7 +88,7 @@ public class AccountsController {
@RequestMapping(value = { "/forwardUpdate/{id}" })
public ModelAndView forwardUpdate(@PathVariable("id") String id) {
ModelAndView modelAndView=new ModelAndView("app/accounts/appAccountsUpdate");
ModelAndView modelAndView=new ModelAndView("/accounts/appAccountsUpdate");
Accounts appAccounts =accountsService.get(id);
appAccounts.setRelatedPassword(ReciprocalUtils.decoder(appAccounts.getRelatedPassword()));

View File

@@ -20,9 +20,9 @@ import com.google.code.kaptcha.Producer;
/**
* @author Crystal.Sea
*
*/
*/
@Controller
@RequestMapping(value = "/captcha")
@RequestMapping(value = "/captcha")
public class CaptchaEndpoint {
private static final Logger _logger = LoggerFactory.getLogger(CaptchaEndpoint.class);