org.springframework.beans.factory.annotation.Autowired.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(9.0k)|赞(0)|评价(0)|浏览(131)

本文整理了Java中org.springframework.beans.factory.annotation.Autowired.<init>()方法的一些代码示例,展示了Autowired.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Autowired.<init>()方法的具体详情如下:
包路径:org.springframework.beans.factory.annotation.Autowired
类名称:Autowired
方法名:<init>

Autowired.<init>介绍

暂无

代码示例

代码示例来源:origin: ityouknow/spring-boot-examples

@Component
public class HelloSender {

  @Autowired
  private AmqpTemplate rabbitTemplate;

  public void send() {
    String context = "hello " + new Date();
    System.out.println("Sender : " + context);
    this.rabbitTemplate.convertAndSend("hello", context);
  }

}

代码示例来源:origin: sqshq/piggymetrics

@RestController
@RequestMapping("/recipients")
public class RecipientController {

  @Autowired
  private RecipientService recipientService;

  @RequestMapping(path = "/current", method = RequestMethod.GET)
  public Object getCurrentNotificationsSettings(Principal principal) {
    return recipientService.findByAccountName(principal.getName());
  }

  @RequestMapping(path = "/current", method = RequestMethod.PUT)
  public Object saveCurrentNotificationsSettings(Principal principal, @Valid @RequestBody Recipient recipient) {
    return recipientService.save(principal.getName(), recipient);
  }
}

代码示例来源:origin: shuzheng/zheng

/**
* CmsCommentService实现
* Created by shuzheng on 2017/4/5.
*/
@Service
@Transactional
@BaseService
public class CmsCommentServiceImpl extends BaseServiceImpl<CmsCommentMapper, CmsComment, CmsCommentExample> implements CmsCommentService {

  private static final Logger LOGGER = LoggerFactory.getLogger(CmsCommentServiceImpl.class);

  @Autowired
  CmsCommentMapper cmsCommentMapper;

}

代码示例来源:origin: hs-web/hsweb-framework

@Configuration
@EnableConfigurationProperties(MybatisProperties.class)
public class MyBatisAutoConfiguration {
  @Autowired(required = false)
  private Interceptor[] interceptors;
  @Autowired
  private ResourceLoader resourceLoader = new DefaultResourceLoader();
  @Autowired(required = false)
  private DatabaseIdProvider databaseIdProvider;
  @Autowired(required = false)
  private EntityFactory entityFactory;

代码示例来源:origin: citerus/dddsample-core

@Configuration
@Import({DDDSampleApplicationContext.class,
    PathfinderApplicationContext.class})
@EnableAutoConfiguration
public class Application {

  @Autowired
  SampleDataGenerator sampleDataGenerator;

  @PostConstruct
  public void init() {
    sampleDataGenerator.generate();
  }

  public static void main(String[] args) throws Exception {
    SpringApplication.run(Application.class, args);
  }
}

代码示例来源:origin: spring-projects/spring-framework

@Component @Lazy
static class StandardPojo {
  @Autowired @Qualifier("interesting") TestBean testBean;
  @Autowired @Boring TestBean testBean2;
}

代码示例来源:origin: macrozheng/mall

/**
 * 商品优选管理Controller
 * Created by macro on 2018/6/1.
 */
@Controller
@Api(tags = "CmsPrefrenceAreaController", description = "商品优选管理")
@RequestMapping("/prefrenceArea")
public class CmsPrefrenceAreaController {
  @Autowired
  private CmsPrefrenceAreaService prefrenceAreaService;

  @ApiOperation("获取所有商品优选")
  @RequestMapping(value = "/listAll", method = RequestMethod.GET)
  @ResponseBody
  public Object listAll() {
    List<CmsPrefrenceArea> prefrenceAreaList = prefrenceAreaService.listAll();
    return new CommonResult().success(prefrenceAreaList);
  }
}

代码示例来源:origin: spring-projects/spring-framework

@Configuration
public static class AStrich {
  @Autowired
  B b;
  @Bean
  public Z z() {
    return new Z();
  }
}

代码示例来源:origin: spring-cloud/spring-cloud-kubernetes

@Configuration
  @Import(KubernetesAutoConfiguration.class)
  @EnableConfigurationProperties({ ConfigMapConfigProperties.class,
      SecretsConfigProperties.class })
  protected static class KubernetesPropertySourceConfiguration {
    @Autowired
    private KubernetesClient client;

    @Bean
    @ConditionalOnProperty(name = "spring.cloud.kubernetes.config.enabled", matchIfMissing = true)
    public ConfigMapPropertySourceLocator configMapPropertySourceLocator(
        ConfigMapConfigProperties properties) {
      return new ConfigMapPropertySourceLocator(client, properties);
    }

    @Bean
    @ConditionalOnProperty(name = "spring.cloud.kubernetes.secrets.enabled", matchIfMissing = true)
    public SecretsPropertySourceLocator secretsPropertySourceLocator(
        SecretsConfigProperties properties) {
      return new SecretsPropertySourceLocator(client, properties);
    }
  }
}

代码示例来源:origin: apache/kylin

@Controller
@RequestMapping(value = "/user_group")
public class KylinUserGroupController extends BasicController {

  @Autowired
  @Qualifier("userGroupService")
  private IUserGroupService userGroupService;

  @RequestMapping(value = "/groups", method = {RequestMethod.GET}, produces = {"application/json"})
  @ResponseBody
  public List<String> listUserAuthorities(@RequestParam(value = "project") String project) throws IOException {
    return userGroupService.listAllAuthorities(project);
  }
}

代码示例来源:origin: 527515025/springBoot

@Controller
public class LoginController {
  @Autowired
  UserService userService;

  @RequestMapping(value = "/login")
  @ResponseBody
  public Object login(@AuthenticationPrincipal User loginedUser, @RequestParam(name = "logout", required = false) String logout) {
    if (logout != null) {
      return null;
    }
    if (loginedUser != null) {
      return userService.getById(loginedUser.getId());
    }
    return null;
  }
}

代码示例来源:origin: hs-web/hsweb-framework

@Configuration
@EnableConfigurationProperties(SchedulerProperties.class)
@ConditionalOnMissingBean({Scheduler.class, SchedulerFactoryBean.class})
@ComponentScan({"org.hswebframework.web.service.schedule.simple"
@Slf4j
public class ScheduleAutoConfiguration {
  @Autowired
  private SchedulerProperties schedulerProperties;
  @Autowired
  private ApplicationContext applicationContext;
  @Autowired
  private DataSource dataSource;
  @Autowired
  private PlatformTransactionManager platformTransactionManager;
  @Autowired(required = false)
  private Map<String, Calendar> calendarMap;
  @Autowired(required = false)
  private SchedulerListener[] schedulerListeners;

代码示例来源:origin: sqshq/piggymetrics

@RestController
@RequestMapping("/users")
public class UserController {

  @Autowired
  private UserService userService;

  @RequestMapping(value = "/current", method = RequestMethod.GET)
  public Principal getUser(Principal principal) {
    return principal;
  }

  @PreAuthorize("#oauth2.hasScope('server')")
  @RequestMapping(method = RequestMethod.POST)
  public void createUser(@Valid @RequestBody User user) {
    userService.create(user);
  }
}

代码示例来源:origin: spring-projects/spring-framework

@Configuration
@Import(NameConfig.class)
static class AutowiredConfig {
  @Autowired String autowiredName;
  @Bean TestBean testBean() {
    TestBean testBean = new TestBean();
    testBean.name = autowiredName;
    return testBean;
  }
}

代码示例来源:origin: gocd/gocd

@Component
public class AgentRemoteHandler {
  private static final Logger LOGGER = LoggerFactory.getLogger(AgentRemoteHandler.class);
  private Map<String, Agent> agentSessions = new ConcurrentHashMap<>();
  @Qualifier("buildRepositoryMessageProducer")
  @Autowired
  private BuildRepositoryRemote buildRepositoryRemote;
  @Autowired
  private AgentService agentService;
  @Autowired
  private JobInstanceService jobInstanceService;
  private ConsoleService consoleService;

代码示例来源:origin: macrozheng/mall

/**
 * 会员等级管理Controller
 * Created by macro on 2018/4/26.
 */
@Controller
@Api(tags = "UmsMemberLevelController",description = "会员等级管理")
@RequestMapping("/memberLevel")
public class UmsMemberLevelController {
  @Autowired
  private UmsMemberLevelService memberLevelService;
  @RequestMapping(value = "/list",method = RequestMethod.GET)
  @ApiOperation("查询所有会员等级")
  @ResponseBody
  public Object list(@RequestParam("defaultStatus") Integer defaultStatus){
    List<UmsMemberLevel> memberLevelList = memberLevelService.list(defaultStatus);
    return new CommonResult().success(memberLevelList);
  }
}

代码示例来源:origin: shuzheng/zheng

/**
* CmsCategoryTagService实现
* Created by shuzheng on 2017/4/5.
*/
@Service
@Transactional
@BaseService
public class CmsCategoryTagServiceImpl extends BaseServiceImpl<CmsCategoryTagMapper, CmsCategoryTag, CmsCategoryTagExample> implements CmsCategoryTagService {

  private static final Logger LOGGER = LoggerFactory.getLogger(CmsCategoryTagServiceImpl.class);

  @Autowired
  CmsCategoryTagMapper cmsCategoryTagMapper;

}

代码示例来源:origin: ityouknow/spring-boot-examples

@Component
public class NeoSender2 {

  @Autowired
  private AmqpTemplate rabbitTemplate;

  public void send(int i) {
    String context = "spirng boot neo queue"+" ****** "+i;
    System.out.println("Sender2 : " + context);
    this.rabbitTemplate.convertAndSend("neo", context);
  }

}

代码示例来源:origin: spring-projects/spring-framework

@Configuration
static class ConcreteFactoryBeanImplementationConfig {
  @Autowired
  private DummyBean dummyBean;
  @Bean
  public MyFactoryBean factoryBean() {
    Assert.notNull(dummyBean, "DummyBean was not injected.");
    return new MyFactoryBean();
  }
}

代码示例来源:origin: apache/shiro

/**
 */
@Controller
public class RestrictedErrorController implements ErrorController {
  private static final String ERROR_PATH = "/error";

  @Autowired
  private ErrorAttributes errorAttributes;

  @Override
  public String getErrorPath() {
    return ERROR_PATH;
  }

  @RequestMapping(ERROR_PATH)
  String error(HttpServletRequest request, Model model) {
    Map<String, Object> errorMap = errorAttributes.getErrorAttributes(new ServletRequestAttributes(request), false);
    model.addAttribute("errors", errorMap);
    return "error";
  }
}

相关文章