tomcat配置修改

This commit is contained in:
zhh 2018-08-07 16:16:01 +08:00
parent 50e8932645
commit c4cb28cf29
2 changed files with 36 additions and 3 deletions

View File

@ -0,0 +1,32 @@
package com.macro.mall.portal.config;
import org.apache.catalina.connector.Connector;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory;
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* tomcat相关配置
* Created by macro on 2018/8/7.
*/
@Configuration
public class TomcatConfig {
@Value("${http.port}")
private Integer port;
@Bean
public EmbeddedServletContainerFactory servletContainer() {
TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory();
tomcat.addAdditionalTomcatConnectors(createStandardConnector()); // 添加http
return tomcat;
}
//配置http
private Connector createStandardConnector() {
Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
connector.setPort(port);
return connector;
}
}

View File

@ -26,14 +26,15 @@ public class OmsCartItemServiceImpl implements OmsCartItemService {
@Override @Override
public int add(OmsCartItem cartItem) { public int add(OmsCartItem cartItem) {
int count;
OmsCartItem existCartItem = getCartItem(cartItem); OmsCartItem existCartItem = getCartItem(cartItem);
if (existCartItem == null) { if (existCartItem == null) {
cartItemMapper.insert(cartItem); count = cartItemMapper.insert(cartItem);
} else { } else {
existCartItem.setQuantity(existCartItem.getQuantity() + cartItem.getQuantity()); existCartItem.setQuantity(existCartItem.getQuantity() + cartItem.getQuantity());
cartItemMapper.updateByPrimaryKey(existCartItem); count = cartItemMapper.updateByPrimaryKey(existCartItem);
} }
return 1; return count;
} }
/** /**