I am trying to get NoUniqueBeanDefinitionException but i am not getting it any clue why i am not getting

2021-05-28T04:21:13

I am trying to get NoUniqueBeanDefinitionException but i am not getting it any clue why i am not getting

package com.example.demo;

public interface IDateGen {

}

package com.example.demo;

import org.springframework.stereotype.Service;

@Service
public class DateGen implements IDateGen {

}


package com.example.demo;

import org.springframework.stereotype.Service;

@Service
public class DateGen2 implements IDateGen  {

}
package com.example.demo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class DateGenUtil {

    @Autowired
    private IDateGen dateGen;

    public IDateGen getDateGen() {
        return dateGen;
    }

    public void setDateGen(IDateGen dateGen) {
        this.dateGen = dateGen;
    }
    
}

package com.example.demo;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;

@SpringBootApplication
public class Demo3Application {

    public static void main(String[] args) {
        ApplicationContext appContext =   SpringApplication.run(Demo3Application.class, args);
        DateGenUtil util =  appContext.getBean(DateGenUtil.class);
        
        System.out.println(util.getDateGen());
    }

}

When i run the main method i getting

com.example.demo.DateGen@6075b2d3

Can anyone tell why i am not getting NoUniqueBeanDefinitionException ? Thanks in advance

Copyright License:
Author:「Kasi Pasa」,Reproduced under the CC 4.0 BY-SA copyright license with link to original source & disclaimer.
Link to:https://stackoverflow.com/questions/67729450/i-am-trying-to-get-nouniquebeandefinitionexception-but-i-am-not-getting-it-any-c

About “I am trying to get NoUniqueBeanDefinitionException but i am not getting it any clue why i am not getting” questions

I am trying to get NoUniqueBeanDefinitionException but i am not getting it any clue why i am not getting package com.example.demo; public interface IDateGen { } package com.example.demo; import...
form2 newF2; newF2 myform = new NewF2(); myform.ShowDialog(); I have the above code. I have a button in form1 that launches form2. I get the following error message "The type or namespace name
I am getting this error when I am trying to perform a segue to another view controller. I don't know why I am getting this error? Thread 1: EXC_BAD_ACCESS override func prepare(for segue:
I am a Jr. Programmer trying to get mp4 videos from an API and save them to a folder on the network. I am using the following code; public static void saveVideos(HttpContent content, String filen...
I am trying to get subtotal using pandas pivoting. I don't know why i am getting only column subtotal? data = {'TypeOfInvestor':['Stocks', 'Bonds', 'Real Estate'], 'InvestorA&
function printManyTimes(str) { var sentence = str + "is cool" for (var i = 0; i < str.length; i += 2) { console.log(sentence); } printManyTimes("Satyam") }&
I am working on FaceRecognition project. For that i am using BRISK algorithm from openbr. For that i have to train data using many number of images. I am using training command as below, br -alg...
Why am I getting this error when I am trying to run my Discord bot [1]: https://i.stack.imgur.com/Bw4OU.png ....
am a newbie in redux, am trying to add an item to the basket but am getting, TypeError: Cannot read properties of undefined (reading 'getState'). why am i not able to get the state, please what am ...
I am using javascript date and I am trying to get it in my own format(YYYY-MM-DD). However, I could manage the format but the problem here is I am getting a day ahead. For eg: if the day is 3(today),

Copyright License:Reproduced under the CC 4.0 BY-SA copyright license with link to original source & disclaimer.