I'm using IntelliJ Ultimate 2019.1.3.
few days ago, I fixed the setting for Transaction. but after that, every controllers show up this error(red underlines).
[ Could not autowired. No beans of '~~Service' type found. ]
however, it works fine. so I'm confused..
this is what I fixed.
/* context-datasource.xml */
<context:component-scan base-package="a.b">
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan>
/* context-transaction.xml */
<tx:annotation-driven transaction-manager="txManager" proxy-target-class="true" />
<bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
</bean>
<tx:advice id="txAdvice" transaction-manager="txManager">
<tx:attributes>
<tx:method name="*" rollback-for="Exception"/>
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut id="requiredTx" expression="execution(* a.b..service.impl.*Impl.*(..))"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="requiredTx" />
</aop:config>
/* dispatcher-servlet.xml */
<context:component-scan base-package="a.b" use-default-filters="false">
<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan>
and here my project.
/* web.xml */
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/config/framework/springmvc/dispatcher-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:framework/spring/context-*.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
/* controller */
@Controller
public class TestController {
private final CodeService codeService;
@Autowired
public TestController(CodeService codeService){ // 'codeService' has a red underlines.
this.codeService = codeService;
}
public TestController(){
this(null);
}
/* service */
public interface TestService { ...
/* serviceImpl */
@Service("TestService")
public class TEstServiceImpl implements TestService { ...
/* mapper */
@Mapper("TestMapper")
public interface TestMapper { ...
what should I do ? can I just ignore that underlines or .. ?