zoukankan      html  css  js  c++  java
  • Java-Class-@I:org.springframework.beans.factory.annotation.Autowired.java

    ylbtech-Java-Class-@I:org.springframework.beans.factory.annotation.Autowired.java
    1.返回顶部
     
    2.返回顶部
    1、
    package com.ylbtech.edu.student.service;
    
    import java.util.List;
    import java.util.Map;
    
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.stereotype.Service;
    import com.ylbtech.edu.student.mapper.StudentMapper;
    import com.ylbtech.edu.student.domain.Student;
    import com.ylbtech.edu.student.service.IStudentService;/**
     * 学生 服务层实现
     * 
     * @author ylbtech
     * @date 2019-01-23
     */
    @Service
    public class StudentServiceImpl implements IStudentService 
    {
        @Autowired
        private StudentMapper studentMapper;
    
        /**
         * 查询学生信息
         * 
         * @param studentID 学生ID
         * @return 学生信息
         */
        @Override
        public Student selectStudentById(String studentID)
        {
            return studentMapper.selectStudentById(studentID);
        }    
    
    }
    2、
    3.返回顶部
     
    4.返回顶部
    1、
    /*
     * Copyright 2002-2017 the original author or authors.
     *
     * Licensed under the Apache License, Version 2.0 (the "License");
     * you may not use this file except in compliance with the License.
     * You may obtain a copy of the License at
     *
     *      http://www.apache.org/licenses/LICENSE-2.0
     *
     * Unless required by applicable law or agreed to in writing, software
     * distributed under the License is distributed on an "AS IS" BASIS,
     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     * See the License for the specific language governing permissions and
     * limitations under the License.
     */
    
    package org.springframework.beans.factory.annotation;
    
    import java.lang.annotation.Documented;
    import java.lang.annotation.ElementType;
    import java.lang.annotation.Retention;
    import java.lang.annotation.RetentionPolicy;
    import java.lang.annotation.Target;
    
    /**
     * Marks a constructor, field, setter method or config method as to be autowired
     * by Spring's dependency injection facilities.
     *
     * <p>Only one constructor (at max) of any given bean class may carry this annotation,
     * indicating the constructor to autowire when used as a Spring bean. Such a
     * constructor does not have to be public.
     *
     * <p>Fields are injected right after construction of a bean, before any config
     * methods are invoked. Such a config field does not have to be public.
     *
     * <p>Config methods may have an arbitrary name and any number of arguments; each of
     * those arguments will be autowired with a matching bean in the Spring container.
     * Bean property setter methods are effectively just a special case of such a general
     * config method. Such config methods do not have to be public.
     *
     * <p>In the case of a multi-arg constructor or method, the 'required' parameter is
     * applicable to all arguments. Individual parameters may be declared as Java-8-style
     * {@link java.util.Optional} or, as of Spring Framework 5.0, also as {@code @Nullable}
     * or a not-null parameter type in Kotlin, overriding the base required semantics.
     *
     * <p>In case of a {@link java.util.Collection} or {@link java.util.Map} dependency type,
     * the container autowires all beans matching the declared value type. For such purposes,
     * the map keys must be declared as type String which will be resolved to the corresponding
     * bean names. Such a container-provided collection will be ordered, taking into account
     * {@link org.springframework.core.Ordered}/{@link org.springframework.core.annotation.Order}
     * values of the target components, otherwise following their registration order in the
     * container. Alternatively, a single matching target bean may also be a generally typed
     * {@code Collection} or {@code Map} itself, getting injected as such.
     *
     * <p>Note that actual injection is performed through a
     * {@link org.springframework.beans.factory.config.BeanPostProcessor
     * BeanPostProcessor} which in turn means that you <em>cannot</em>
     * use {@code @Autowired} to inject references into
     * {@link org.springframework.beans.factory.config.BeanPostProcessor
     * BeanPostProcessor} or
     * {@link org.springframework.beans.factory.config.BeanFactoryPostProcessor BeanFactoryPostProcessor}
     * types. Please consult the javadoc for the {@link AutowiredAnnotationBeanPostProcessor}
     * class (which, by default, checks for the presence of this annotation).
     *
     * @author Juergen Hoeller
     * @author Mark Fisher
     * @since 2.5
     * @see AutowiredAnnotationBeanPostProcessor
     * @see Qualifier
     * @see Value
     */
    @Target({ElementType.CONSTRUCTOR, ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD, ElementType.ANNOTATION_TYPE})
    @Retention(RetentionPolicy.RUNTIME)
    @Documented
    public @interface Autowired {
    
        /**
         * Declares whether the annotated dependency is required.
         * <p>Defaults to {@code true}.
         */
        boolean required() default true;
    
    }
    2、
    5.返回顶部
     
     
    6.返回顶部
     
    warn 作者:ylbtech
    出处:http://ylbtech.cnblogs.com/
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
  • 相关阅读:
    微服务架构 技能图谱skill-map
    LiveTelecast直播平台技术图谱skill-map
    OpenResty 技术图谱skill-map
    HearthBuddy 召唤随从的问题
    五子棋AI教程
    HearthAgent A Hearthstone agent
    Monte Carlo Tree Search – beginners guide
    Programming a Hearthstone agent using Monte Carlo Tree Search(chapter one)
    Add hyperlink to textblock wpf
    What do you do as a DevOps?
  • 原文地址:https://www.cnblogs.com/storebook/p/11097530.html
Copyright © 2011-2022 走看看