java Spring基本配置

archetypeCatalog : internal
设置镜像路径 : https://blog.csdn.net/pyfysf/article/details/81028145

报错:org.springframework.beans.factory.BeanCreationException
https://blog.csdn.net/qq_23184291/article/details/78086398

报错:通配符的匹配很全面, 但无法找到元素 'mvc:annotation-driven' 的声明
https://blog.csdn.net/tolcf/article/details/50845483 ----这个就修改一个地址 cache-> mvc

Interllij idea 报错maven [ERROR] Maven execution terminated abnormally (exit code 1)
https://blog.csdn.net/yanghaibobo110/article/details/73835469

image.png

DefaultServlet-servlet.xml 配置




    
    

    
        
        
    

web.xml 入口文件




  Archetype Created Web Application
  
  
    DefaultServlet
    org.springframework.web.servlet.DispatcherServlet
  
    
        DefaultServlet
        /
    

MyController.java 这个文件比较简单

package com.piglite.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
@RequestMapping(value = "/demo",method = RequestMethod.GET)
public class MyController {
    @RequestMapping("/welcome")
    public String welcome(){
        return "welcome";
    }
}

meaven 的 pom.xml 配置文件




  4.0.0

  com.test
  test
  1.0-SNAPSHOT
  war
  test Maven Webapp
  http://www.example.com

  
    UTF-8
    1.7
    1.7
    4.3.5.RELEASE
  

  
    
    
      org.springframework
      spring-core
      ${spring.version}
    
    
      org.springframework
      spring-web
      ${spring.version}
    
    
      org.springframework
      spring-webmvc
      ${spring.version}
    
    
      org.springframework
      spring-test
      ${spring.version}
    

    
      junit
      junit
      4.11
      test
    
  

  
    test
    
      
        
          maven-clean-plugin
          3.0.0
        
        
        
          maven-resources-plugin
          3.0.2
        
        
          maven-compiler-plugin
          3.7.0
        
        
          maven-surefire-plugin
          2.20.1
        
        
          maven-war-plugin
          3.2.0
        
        
          maven-install-plugin
          2.5.2
        
        
          maven-deploy-plugin
          2.8.2
        
      
    
  

我在 meaven/conf/settings.xml 中修改了镜像路径

  
      
          repo2
          central
          Human Readable Name for this Mirror.
          http://repo2.maven.org/maven2/
      
  

终于配置成功了,一路参考过来,
感谢博客:https://blog.csdn.net/piglite/article/details/54412710

记录一份


image.png




Spring MVC 传参:https://www.cnblogs.com/xiaoxi/p/5695783.html

引入spring-jdbc


    org.springframework
    spring-jdbc
    ${spring.version}

你可能感兴趣的:(java Spring基本配置)