Spring是一个开源框架,Spring是于2003 年兴起的一个轻量级的Java 开发框架,由Rod Johnson 在其著作Expert One-On-One J2EE Development and Design中阐述的部分理念和原型衍生而来。它是为了解决企业应用开发的复杂性而创建的。Spring使用基本的JavaBean来完成以前只可能由EJB完成的事情。然而,Spring的用途不仅限于服务器端的开发。从简单性、可测试性和松耦合的角度而言,任何Java应用都可以从Spring中受益。 简单来说,Spring是一个轻量级的控制反转(IOC)和面向切面(AOP)的容器框架。
###** SpringMVC** Spring MVC属于SpringFrameWork的后续产品,已经融合在Spring Web Flow里面。Spring MVC 分离了控制器、模型对象、分派器以及处理程序对象的角色,这种分离让它们更容易进行定制。
package com.test.ssmDemo.controller;
import com.test.ssmDemo.service.UserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class UserController {
@Autowired
private UserService userService;
public static final Logger logger;
static {
logger = LoggerFactory.getLogger(UserController.class);
}
@RequestMapping(value = "/getUserList", method = RequestMethod.GET)
public void getUserList() {
logger.info(userService.getUserList().toString());
}
}
2.Service
package com.test.ssmDemo.controller;
import com.test.ssmDemo.service.UserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class UserController {
@Autowired
private UserService userService;
public static final Logger logger;
static {
logger = LoggerFactory.getLogger(UserController.class);
}
@RequestMapping(value = "/getUserList", method = RequestMethod.GET)
public void getUserList() {
logger.info(userService.getUserList().toString());
}
}
3.ServiceImpl
package com.test.ssmDemo.service.impl;
import com.test.ssmDemo.mapper.UserMapper;
import com.test.ssmDemo.model.User;
import com.test.ssmDemo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class UserServiceImpl implements UserService {
@Autowired
private UserMapper userMapper;
@Override
public List getUserList() {
return userMapper.selectUserList();
}
}
4.UserMapper.java
package com.test.ssmDemo.mapper;
import com.test.ssmDemo.model.User;
import java.util.List;
public interface UserMapper {
int deleteByPrimaryKey(String userId);
int insert(User record);
int insertSelective(User record);
User selectByPrimaryKey(String userId);
int updateByPrimaryKeySelective(User record);
int updateByPrimaryKey(User record);
List selectUserList();
}
5.UserMapper.xml
user_id, name, age, tel
delete from user
where user_id = #{userId,jdbcType=VARCHAR}
insert into user (user_id, name, age,
tel)
values (#{userId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{age,jdbcType=INTEGER},
#{tel,jdbcType=VARCHAR})
insert into user
user_id,
name,
age,
tel,
#{userId,jdbcType=VARCHAR},
#{name,jdbcType=VARCHAR},
#{age,jdbcType=INTEGER},
#{tel,jdbcType=VARCHAR},
update user
name = #{name,jdbcType=VARCHAR},
age = #{age,jdbcType=INTEGER},
tel = #{tel,jdbcType=VARCHAR},
where user_id = #{userId,jdbcType=VARCHAR}
update user
set name = #{name,jdbcType=VARCHAR},
age = #{age,jdbcType=INTEGER},
tel = #{tel,jdbcType=VARCHAR}
where user_id = #{userId,jdbcType=VARCHAR}
XMLHttpRequest cannot load http://v.xxx.com. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:63342' is therefore not allowed access. test.html:1
1.什么是NoSQL数据库?NoSQL和RDBMS有什么区别?在哪些情况下使用和不使用NoSQL数据库?
NoSQL是非关系型数据库,NoSQL = Not Only SQL。
关系型数据库采用的结构化的数据,NoSQL采用的是键值对的方式存储数据。
在处理非结构化/半结构化的大数据时;在水平方向上进行扩展时;随时应对动态增加的数据项时可以优先考虑使用NoSQL数据库。
在考虑数据库的成熟
ClientWatchManager接口
//接口的唯一方法materialize用于确定那些Watcher需要被通知
//确定Watcher需要三方面的因素1.事件状态 2.事件类型 3.znode的path
public interface ClientWatchManager {
/**
* Return a set of watchers that should
解决mysql导入导出数据乱码问题方法:
1、进入mysql,通过如下命令查看数据库编码方式:
mysql> show variables like 'character_set_%';
+--------------------------+----------------------------------------+
| Variable_name&nbs
Your love is also your weak point.
你的所爱同时也是你的弱点。
If anything in this life is certain, if history has taught us anything, it is
that you can kill anyone.
不顾家的人永远不可能成为一个真正的男人。 &
用phpMyAdmin导入mysql数据库时,我的10M的
数据库不能导入,提示mysql数据库最大只能导入2M。
phpMyAdmin数据库导入出错: You probably tried to upload too large file. Please refer to documentation for ways to workaround this limit.
1、create database school 创建数据库school
2、drop database school 删除数据库school
3、use school 连接到school数据库,使其成为当前数据库
4、create table class(classID int primary key identity not null)
创建一个名为class的表,其有一