(有数据库,rest soap 共存)restful cxf maven jdbctemplate 类似七牛 图床 设计 demo

简介: 源码下载   http://download.csdn.net/download/knight_black_bob/9435077       效果图     http://localhost:8080/RepositoryPic/WebService/      ...

源码下载   http://download.csdn.net/download/knight_black_bob/9435077

 

 

 

效果图

 

 

http://localhost:8080/RepositoryPic/WebService/




 

 

 

 

http://localhost:8080/RepositoryPic/WebService/rest/picRepository/users/1/pics/1

 http://localhost:8080/RepositoryPic/WebService/rest/showPic/users/1/pics/aaa.png

 

 

 

 

pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>com.repository</groupId>
	<artifactId>RepositoryPic</artifactId>
	<packaging>war</packaging>
	<version>0.0.1-SNAPSHOT</version>
	<name>RepositoryPic Maven Webapp</name>
	<url>http://maven.apache.org</url>
	
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <java.version>1.7</java.version>
    <!-- <spring.version>3.2.8.RELEASE</spring.version> -->
  	<spring.version>4.1.2.RELEASE</spring.version>
    <servlet.api.version>2.5</servlet.api.version>
    <slf4j.version>1.7.5</slf4j.version>
    <cxf.version>2.7.12</cxf.version>
    <jackson.version>2.1.4</jackson.version> 
  	<commons.version>2.2</commons.version>
  </properties>
  
  <dependencies>
  <dependency>
    <groupId>commons-io</groupId>
    <artifactId>commons-io</artifactId>
    <version>${commons.version}</version>
  </dependency>

  <dependency>
    <groupId>commons-lang</groupId>
    <artifactId>commons-lang</artifactId>
    <version>${commons.version}</version>
  </dependency>
  
  
   <dependency>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
    <version>1.2.17</version>
  </dependency>
   
  <dependency>
    <groupId>commons-fileupload</groupId>
    <artifactId>commons-fileupload</artifactId>
    <version>1.3.1</version>
  </dependency>
  
  
  <dependency>
  <groupId>org.apache.commons</groupId>
  <artifactId>commons-lang3</artifactId>
  <version>3.3</version>
  </dependency>
  
  <dependency>
  <groupId>commons-dbcp</groupId>
  <artifactId>commons-dbcp</artifactId>
  <version>1.4</version>
 </dependency>
  
   <dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <version>5.1.34</version>
  </dependency>
  
  
  <!-- SPRING JDBC -->
  <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-jdbc</artifactId>
    <version>${spring.version}</version>
  </dependency>
  <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-tx</artifactId>
    <version>${spring.version}</version>
  </dependency>
  <dependency>
    <groupId>javax.transaction</groupId>
    <artifactId>transaction-api</artifactId>
    <version>1.1</version>
  </dependency>
  <dependency>
    <groupId>org.aspectj</groupId>
    <artifactId>aspectjweaver</artifactId>
    <version>1.8.4</version>
  </dependency>
  
  
    <!-- spring begin -->
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-core</artifactId>
      <version>${spring.version}</version>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-beans</artifactId>
      <version>${spring.version}</version>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-orm</artifactId>
      <version>${spring.version}</version>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-context</artifactId>
      <version>${spring.version}</version>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-webmvc-portlet</artifactId>
      <version>${spring.version}</version>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-webmvc</artifactId>
      <version>${spring.version}</version>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-web</artifactId>
      <version>${spring.version}</version>
    </dependency>
    <!-- spring end -->

    <!-- @Inject begin -->
    <dependency>
      <groupId>javax.inject</groupId>
      <artifactId>javax.inject</artifactId>
      <version>1</version>
    </dependency>
    <!-- @Inject end -->
        
    <!-- servlet begin -->
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>servlet-api</artifactId>
      <version>${servlet.api.version}</version>
    </dependency>
    <!-- servlet end -->

    <!-- cxf begin -->
    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-rt-frontend-jaxws</artifactId>
      <version>${cxf.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-rt-frontend-jaxrs</artifactId>
      <version>${cxf.version}</version>
      <exclusions>
		      <exclusion>
		      <groupId>asm</groupId>
   			 <artifactId>asm-parent</artifactId>
		      </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-rt-rs-extension-providers</artifactId>
      <version>${cxf.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-rt-transports-http</artifactId>
      <version>${cxf.version}</version>
    </dependency>
    <dependency>
      <groupId>org.codehaus.jettison</groupId>
      <artifactId>jettison</artifactId>
      <version>1.3.2</version>
    </dependency>
    <dependency>
      <groupId>javax.ws.rs</groupId>
      <artifactId>jsr311-api</artifactId>
      <version>1.1.1</version>
    </dependency>
    <!-- cxf end -->

    <!-- JSON begin -->
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-core</artifactId>
      <version>${jackson.version}</version>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
      <version>${jackson.version}</version>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-annotations</artifactId>
      <version>${jackson.version}</version>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.module</groupId>
      <artifactId>jackson-module-jaxb-annotations</artifactId>
      <version>${jackson.version}</version>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.jaxrs</groupId>
      <artifactId>jackson-jaxrs-json-provider</artifactId>
      <version>${jackson.version}</version>
    </dependency>
    <dependency>
      <groupId>org.codehaus.jackson</groupId>
      <artifactId>jackson-mapper-asl</artifactId>
      <version>1.9.0</version>
    </dependency>
    <dependency>
      <groupId>org.codehaus.jackson</groupId>
      <artifactId>jackson-core-asl</artifactId>
      <version>1.9.0</version>
    </dependency>
    <!-- JSON end -->
  </dependencies>

	<reporting>
	 <plugins>
		<!-- findbugs plugin -->
		<plugin>
			<groupId>org.codehaus.mojo</groupId>
			<artifactId>findbugs-maven-plugin</artifactId>
			<version>3.0.3</version>
			<configuration>
				<xmlOutput>true</xmlOutput>
				<xmlOutputDirectory>target/site</xmlOutputDirectory>
			</configuration>
		</plugin>
	  </plugins>
     </reporting>
</project>

 

 

 applicationContext-cxf-soap.xml

<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
	xmlns:p="http://www.springframework.org/schema/p"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:jaxws="http://cxf.apache.org/jaxws"
	xsi:schemaLocation="http://www.springframework.org/schema/beans   http://www.springframework.org/schema/beans/spring-beans-3.0.xsd  
           http://www.springframework.org/schema/context    http://www.springframework.org/schema/context/spring-context-3.0.xsd
	       http://cxf.apache.org/jaxws  http://cxf.apache.org/schemas/jaxws.xsd"
	default-autowire="byName">
 	
	
    <import resource="classpath:META-INF/cxf/cxf.xml" />
	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
	
    <bean id="inMessageInterceptor" class="org.apache.cxf.interceptor.LoggingInInterceptor"/>    
	<bean id="outLoggingInterceptor" class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>  
	
	<jaxws:endpoint implementor="cmcc.picrepository.webservice.impl.PicRepositorySoapServiceImpl" address="/picRepositorySoapService"></jaxws:endpoint>
   
</beans>

 

applicationContext-cxf-rest.xml

 

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
	xmlns:jaxrs="http://cxf.apache.org/jaxrs"
	xmlns:cxf="http://cxf.apache.org/core"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
		http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
		http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd">

 	
	
  <import resource="classpath*:META-INF/cxf/cxf.xml" />
  <import resource="classpath*:META-INF/cxf/cxf-extension-soap.xml" />
  <import resource="classpath*:META-INF/cxf/cxf-servlet.xml" />

  <jaxrs:server id="restServiceContainer" address="/rest">
    <jaxrs:providers>
      <ref bean="jacksonProvider" />
    </jaxrs:providers>
    <jaxrs:extensionMappings>
      <entry key="json" value="application/json" />
      <entry key="xml" value="application/xml" />
    </jaxrs:extensionMappings>

    <jaxrs:serviceBeans>
      <ref bean="picRepositoryRestService" />
       <ref bean="showPicRestService" />
    </jaxrs:serviceBeans>

    <jaxrs:inInterceptors>
      <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"></bean>
    </jaxrs:inInterceptors>
    <jaxrs:outInterceptors>
      <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"></bean>
    </jaxrs:outInterceptors>
  </jaxrs:server>

  <bean id="jacksonObjectMapper" class="org.springframework.http.converter.json.Jackson2ObjectMapperFactoryBean"></bean>
  <bean id="jacksonProvider"  class="com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider">
    <property name="mapper" ref="jacksonObjectMapper" />
  </bean>
</beans>

 

 

 

 

package cmcc.picrepository.restfulservice;
 
import javax.annotation.Resource;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.ResponseBuilder;
import javax.ws.rs.core.Response.Status; 

import org.springframework.stereotype.Component; 

import cmcc.picrepository.dto.PicRepository;
import cmcc.picrepository.dto.PicRepositorys;
import cmcc.picrepository.webservice.PicRepositorySoapService;
 

/**
 * @author baoyou E-mail:curiousby@163.com
 * @version 2016年2月16日 下午1:47:41
 *
 * desc: ...
 */
@Path(value = "/picRepository")
@Produces({ MediaType.APPLICATION_XML}) 
@Consumes({ MediaType.APPLICATION_XML}) 
@Component 
public class PicRepositoryRestService {
 
	@Resource
	PicRepositorySoapService picRepositorySoapService;
	
	@GET
	 @Produces({ MediaType.APPLICATION_XML})  
	@Path("/users/{userId}/pics/{picRepositoryId}")
	public PicRepository getPicRepository(@PathParam("userId")int userId,@PathParam("picRepositoryId")int picRepositoryId) {
		PicRepository picRepository =picRepositorySoapService.get(picRepositoryId);
		if (picRepository == null) {
			ResponseBuilder builder = Response.status(Status.NOT_FOUND);
			builder.type("application/xml");
			builder.entity("<errorMsg>PicRepository with id:" + picRepositoryId+ " can not be found!</errorMsg>");
			throw new WebApplicationException(builder.build());
		} else {
			System.out.println("PicRepository with id:" + picRepositoryId+ " is found");
			return picRepository;
		}
	}

	@POST
	@Consumes({ MediaType.APPLICATION_XML})
	@Path("/add")
	public Response addPicRepository(PicRepository picRepository) {
		picRepositorySoapService.add(picRepository);
		return Response.ok(picRepository).build();
	}

	@DELETE
	@Consumes({ MediaType.APPLICATION_XML})
	@Path("/delete/{picRepositoryId}")
	public Response deletePicRepository(@PathParam("picRepositoryId")int picRepositoryId) { 
		return null;
	}

	@PUT
	@Path("/put")
	@Consumes({ MediaType.APPLICATION_XML})
	public Response updatePicRepository(PicRepository picRepository) {
		return null;
	}

	@GET
	@Path("/getAlls")
	@Produces({ MediaType.APPLICATION_XML})
	public PicRepositorys getPicRepositorys() {
		return null;
	}

}

 

package cmcc.picrepository.restfulservice;

import java.io.File; 

import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces; 
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;  

import org.springframework.stereotype.Component; 


/**
 * @author baoyou E-mail:curiousby@163.com
 * @version 2016年2月17日 下午2:26:59
 *
 * desc: ...
 */
@Path(value = "/showPic")
@Produces({ MediaType.APPLICATION_XML}) 
@Consumes({ MediaType.APPLICATION_XML})
@Component
public class ShowPicRestService {

	@GET
	@Produces("image/*")
	@Path("/users/{userId}/pics/{picName}")
	public Response getInputStream(@PathParam("userId")int   userId,@PathParam("picName")String   picName) {
		File file = new File("C:\\Users\\cmcc-B100036\\Desktop\\1.png");
		
		
	    return Response.ok(file,"image/jpg").build();
	}
}

 

package cmcc.picrepository.webservice;

import java.util.List;

import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;

import cmcc.picrepository.dto.PicRepository; 

/**
 * @author baoyou E-mail:curiousby@163.com
 * @version 2016年2月18日 上午9:51:35
 *
 * desc: ...
 */
@WebService
@SOAPBinding(style = Style.RPC)
public interface PicRepositorySoapService {
	
   public List<PicRepository> getAlls();
   public void del(Integer picRepositoryId);
   public PicRepository get(Integer picRepositoryId);
   public void update(PicRepository picRepository);
   public void add(PicRepository picRepository);
}

 

package cmcc.picrepository.webservice.impl;

import java.util.List;

import javax.annotation.Resource;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;

import org.springframework.stereotype.Service;

import cmcc.picrepository.dao.PicRepositoryDao;
import cmcc.picrepository.dto.PicRepository;
import cmcc.picrepository.webservice.PicRepositorySoapService;

/**
 * @author baoyou E-mail:curiousby@163.com
 * @version 2016年2月18日 上午9:54:43
 *
 * desc: ...
 */
@Service 
@WebService(endpointInterface="cmcc.picrepository.webservice.PicRepositorySoapService", serviceName="PicRepositorySoapService")
@SOAPBinding(style = Style.RPC) 
public class PicRepositorySoapServiceImpl implements PicRepositorySoapService{

	@Resource
	PicRepositoryDao picRepositoryDao; 
	
	@Override
	public List<PicRepository> getAlls() { 
		return null;
	}

	@Override
	public void del(Integer picRepositoryId) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public PicRepository get(Integer picRepositoryId) {
		return picRepositoryDao.getPicRepositoryById(picRepositoryId);
	}

	@Override
	public void update(PicRepository picRepository) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void add(PicRepository picRepository) {
		// TODO Auto-generated method stub
		
	}
	

}

 

package cmcc.picrepository.util;
import java.text.SimpleDateFormat; 
import java.util.Date; 
 
import javax.xml.bind.annotation.adapters.XmlAdapter; 
 
public class DateAdapter extends XmlAdapter<String, Date> { 
 
    private SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 
 
    @Override 
    public String marshal(Date v) throws Exception { 
        return dateFormat.format(v); 
    } 
 
    @Override 
    public Date unmarshal(String v) throws Exception { 
        return dateFormat.parse(v); 
    } 
} 

 

 

package cmcc.picrepository.dto;

import java.io.Serializable;
import java.util.Date;
 




import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement; 
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;

import cmcc.picrepository.util.DateAdapter;
 
 

/**
 * @author baoyou E-mail:curiousby@163.com
 * @version 2016年2月15日 上午11:25:20
 *
 * desc: ...
 */ 
@XmlRootElement(name = "PicRepository") 
@XmlAccessorType(XmlAccessType.FIELD) 
public class PicRepository  implements Serializable{
	private static final long serialVersionUID = 1L;
//	id,origin_name,path,user_id,link,insert_time,last_update_time,desc,nextfix,pic_size
	 
	private int id; 
	private String originName; 
	private String path; 
	private int userId; 
	private String link; 
	@XmlJavaTypeAdapter(DateAdapter.class) 
	private Date insertTime;
	@XmlJavaTypeAdapter(DateAdapter.class) 
	private Date lastUpdateTime; 
	private String description; 
	private String nextfix; 
	private int picSize;
	
	
	public int getId() {
		return id;
	}
	public String getOriginName() {
		return originName;
	}
	public String getPath() {
		return path;
	}
	public int getUserId() {
		return userId;
	}
	public String getLink() {
		return link;
	}
	public Date getInsertTime() {
		return insertTime;
	}
	public Date getLastUpdateTime() {
		return lastUpdateTime;
	}
	public String getDescription() {
		return description;
	}
	public String getNextfix() {
		return nextfix;
	}
	public int getPicSize() {
		return picSize;
	}
	public void setId(int id) {
		this.id = id;
	}
	public void setOriginName(String originName) {
		this.originName = originName;
	}
	public void setPath(String path) {
		this.path = path;
	}
	public void setUserId(int userId) {
		this.userId = userId;
	}
	public void setLink(String link) {
		this.link = link;
	}
	public void setInsertTime(Date insertTime) {
		this.insertTime = insertTime;
	}
	public void setLastUpdateTime(Date lastUpdateTime) {
		this.lastUpdateTime = lastUpdateTime;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public void setNextfix(String nextfix) {
		this.nextfix = nextfix;
	}
	public void setPicSize(int picSize) {
		this.picSize = picSize;
	}
}

 

 

package cmcc.picrepository.dao.impl;

import java.sql.ResultSet;
import java.sql.SQLException; 
import java.util.List;
 


import org.springframework.jdbc.core.RowMapper; 
import org.springframework.stereotype.Repository; 
   

import cmcc.picrepository.base.dao.JdbcTempBaseDao;
import cmcc.picrepository.dao.PicRepositoryDao;
import cmcc.picrepository.dto.PicRepository;
 

/**
 * @author baoyou E-mail:curiousby@163.com
 * @version 2016年2月15日 下午2:59:54
 *
 * desc: ...
 */
@Repository
public class PicRepositoryDaoImpl   extends JdbcTempBaseDao  implements PicRepositoryDao{

	 
	@SuppressWarnings({ "rawtypes" })
	private class PicRepositoryRowMapper implements RowMapper {
		@Override
		public PicRepository mapRow(ResultSet rs, int i) throws SQLException {
			PicRepository pr = new PicRepository();
			pr.setId(rs.getInt("id"));
			pr.setOriginName(rs.getString("origin_name"));
			pr.setPath(rs.getString("path"));
			pr.setUserId(rs.getInt("user_id"));
			pr.setLink(rs.getString("link"));
			pr.setInsertTime(rs.getDate("insert_time"));
			pr.setLastUpdateTime(rs.getDate("last_update_time"));
			pr.setDescription(rs.getString("description"));
			pr.setNextfix(rs.getString("nextfix"));
			pr.setPicSize(rs.getInt("pic_size"));
			return pr;
		}
	}
	 
	@SuppressWarnings("unchecked")
	@Override
	public List<PicRepository> getAlls() {
		String sql = "select * from picrepository";
		return this.getJdbcTemplate().query(sql, new PicRepositoryRowMapper());
	}
	
	
	@SuppressWarnings("unchecked")
	@Override
	public PicRepository getPicRepositoryById(int picRepositoryId) {
		String sql = "select * from picrepository where id=" + picRepositoryId; 
		List<PicRepository> userList = this.getJdbcTemplate().query(sql, new PicRepositoryRowMapper());
		if (userList !=null && userList.size() > 0 ) {
			return userList.get(0);
		}else{
			return null;	
		}
	}
	
	@Override
	public int savePicRepository(PicRepository picRepository) {
		String sql = "insert into picrepository(origin_name,path,user_id,link,insert_time,last_update_time,description,nextfix,pic_size) values (?,?,?,?,?,?,?,?,?)";
		return this.getJdbcTemplate().update(sql, new Object[] {
				 picRepository.getOriginName() 
				,picRepository.getPath()
				,picRepository.getUserId()
				,picRepository.getLink()
				,picRepository.getInsertTime()
				,picRepository.getLastUpdateTime()
				,picRepository.getDescription()
				,picRepository.getNextfix()
				,picRepository.getPicSize()
		});
	}
}

 

 

package cmcc.picrepository.base.dao;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;

import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.support.JdbcDaoSupport;

/**
 * @author baoyou E-mail:curiousby@163.com
 * @version 2016年2月17日 上午11:42:53
 *
 *          desc: ...
 */
public class JdbcTempBaseDao extends JdbcDaoSupport {
 
	@Resource(name = "jdbcTemplate")
	public JdbcTemplate jdbcTemplate;

	@PostConstruct
	public void initSqlMapClient() {
		super.setJdbcTemplate(jdbcTemplate);
	}
}

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

捐助开发者

在兴趣的驱动下,写一个免费的东西,有欣喜,也还有汗水,希望你喜欢我的作品,同时也能支持一下。 当然,有钱捧个钱场(右上角的爱心标志,支持支付宝和PayPal捐助),没钱捧个人场,谢谢各位。



 
 
 谢谢您的赞助,我会做的更好!

 

 

目录
相关文章
|
1月前
|
Java 关系型数据库 MySQL
springboot学习四:springboot链接mysql数据库,使用JdbcTemplate 操作mysql
这篇文章是关于如何使用Spring Boot框架通过JdbcTemplate操作MySQL数据库的教程。
23 0
springboot学习四:springboot链接mysql数据库,使用JdbcTemplate 操作mysql
|
3月前
|
SQL 数据库
Spring5入门到实战------13、使用JdbcTemplate操作数据库(批量增删改)。具体代码+讲解 【下篇】
这篇文章是Spring5框架的实战教程,深入讲解了如何使用JdbcTemplate进行数据库的批量操作,包括批量添加、批量修改和批量删除的具体代码实现和测试过程,并通过完整的项目案例展示了如何在实际开发中应用这些技术。
Spring5入门到实战------13、使用JdbcTemplate操作数据库(批量增删改)。具体代码+讲解 【下篇】
|
3月前
|
XML 数据库 数据格式
Spring5入门到实战------14、完全注解开发形式 ----JdbcTemplate操作数据库(增删改查、批量增删改)。具体代码+讲解 【终结篇】
这篇文章是Spring5框架的实战教程的终结篇,介绍了如何使用注解而非XML配置文件来实现JdbcTemplate的数据库操作,包括增删改查和批量操作,通过创建配置类来注入数据库连接池和JdbcTemplate对象,并展示了完全注解开发形式的项目结构和代码实现。
Spring5入门到实战------14、完全注解开发形式 ----JdbcTemplate操作数据库(增删改查、批量增删改)。具体代码+讲解 【终结篇】
|
3月前
|
SQL XML Java
Spring5入门到实战------12、使用JdbcTemplate操作数据库(增删改查)。具体代码+讲解 【上篇】
这篇文章是Spring5框架的实战教程,详细讲解了如何使用JdbcTemplate进行数据库的增删改查操作,包括在项目中引入依赖、配置数据库连接池、创建实体类、定义DAO接口及其实现,并提供了具体的代码示例和测试结果,最后还提供了完整的XML配置文件和测试代码。
Spring5入门到实战------12、使用JdbcTemplate操作数据库(增删改查)。具体代码+讲解 【上篇】
|
5月前
|
JSON 前端开发 Java
Springboot mvc开发之Rest风格及RESTful简化开发案例
Springboot mvc开发之Rest风格及RESTful简化开发案例
63 2
|
5月前
|
SQL druid Java
传统后端SQL数据层替代解决方案: 内置数据源+JdbcTemplate+H2数据库 详解
传统后端SQL数据层替代解决方案: 内置数据源+JdbcTemplate+H2数据库 详解
61 1
|
5月前
|
XML 安全 API
API攻防-接口安全&SOAP&OpenAPI&RESTful&分类特征导入&项目联动检测
API攻防-接口安全&SOAP&OpenAPI&RESTful&分类特征导入&项目联动检测
|
5月前
|
安全 Java API
Java一分钟之-Spring Data REST:创建RESTful服务
【6月更文挑战第15天】Spring Data REST让基于Spring Data的项目轻松创建REST API,免去大量控制器代码。通过自动HTTP映射和链接生成,简化CRUD操作。文章涵盖启用REST、配置仓库、自定义端点、解决过度暴露、缺失逻辑和安全性问题,提供代码示例,如自定义Repository、投影和安全配置,强调在利用其便利性时注意潜在挑战。
76 5
|
4月前
|
XML 缓存 API
REST原则、RESTful架构
REST原则、RESTful架构
47 0
|
6月前
|
前端开发 IDE Java
基于Springboot+MYSQL+Maven实现的宠物医院管理系统(源码+数据库+运行指导文档+项目运行指导视频)
基于Springboot+MYSQL+Maven实现的宠物医院管理系统(源码+数据库+运行指导文档+项目运行指导视频)
284 0

推荐镜像

更多